Duplicate Entries

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a database that tracks our student's performance... they sit at a
machine where they first create their student record by entering their ID
number and name... The ID number is the primary key for the table. The
problem that I am having is sometimes users are already in the DB. How can I
create a method that they will be able to enter their info and if they DON'T
exist create a new record (this is done), but if they DO exist, just pull up
that record and allow them to continue. Anysuggestions greatly appeciated...
 
well, you could use a DCount() function to check for the existence of the ID
number, prior to creating the new record, as

If DCount(1, "MyTable","IDNumber = " & Me!IDNumber) > 0 Then
' code to "pull up that record"
Else
' code to create a new record
End If

hth
 
I actually came up with my own annswer that was a slittle simpler... I just
wrote in a Save record with:
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70

And then added the Error call for to do the same action, but without saving
the record first. It worked.
 
Back
Top