thanks for your replies! As this is a database that holds info on groups and families that come to camp events, I can't really use name as a primary key. Always run the chance of 2 tom smiths. SSN won't work either since collecting data for groups and individuals alike. And to be real honest, I think I would have a hard time getting folks to fill that out on a registration form. Getting complete information is difficult...especially when we are now asking them to register for a weekend event that they have been coming to for years and didn't have to fill out forms for before! that's a whole new issue.
Anyway, the database starts with a table that has an autonumber (key) and first and last/organization name. This has a one to many relationship to a members table that records the "members" of the group and/or family. Each of those records has a one to many to an address table, since we are trying to collect work, home, away at college, etc...addresses. I want to show family relationships, as well as relationships of individuals to organizations. i.e. Tom Smith comes to our volunteer work weekend, is the leader of the scout troop that comes in the fall and his wife comes to women's wellness weekends with her daughter. This information will also be used for alumni/fundraising purposes so am interested in history. Unless there is a way that I can have an PK using fields from more than one table, I can't really use address, phone number, etc... I really don't think you can have a PK like that but I've learned that almost anything you can think of is possible with access if you stare at it long enough!
I hunted around the threads and came up with the following. If I enter the name smith in last/org name field and already have a smith or two, a form will open that shows me all the smiths in the house/org table and their address so I can tell if I have already entered that same person. What would be really neat is if I could get the form to show not only smiths, but smithson, smitt, etc...so if the name isn't entered exactly the same you still can see that you might have a duplicate. this is what I have so far:
Private Sub Last_Org_Name_BeforeUpdate(Cancel As Integer)
Dim dbs As Database
Dim rst As Recordset
Set dbs = CurrentDb()
Set rst = dbs.OpenRecordset("household/org table"
Do Until rst.EOF
If rst![Last/Org Name] = Me![Last/Org Name] Then
GoTo theend
Else
rst.MoveNext
End If
Loop
Exit Sub
theend:
DoCmd.OpenForm "find hse/org duplicate"
Dim Msg, Style, title, response, mystring
Msg = "This may be a duplicate record. Do you want to enter a new record?" 'define message.
Style = vbYesNo + vbCritical 'define buttons.
title = "Duplicate record warning" 'Define title.
'Display message.
response = MsgBox(Msg, Style, title)
If response = vbNo Then
Cancel = True
End If
DoCmd.Close acForm, "find hse/org duplicate", acSaveYes
End Sub
The form's query has the last/org name field on the form as a parameter. so if I enter smith, all the smiths are returned. I tried using like[forms]![hse/org]![last/org name]* with " and ( every which way but loose and couldn't get what I wanted. Any suggestions?