check to see if record exists
UtterAccess Discussion Forums
Aug 9 2008, 09:03 AM
Is there a way I can see if a record exists in a table?
something along the lines of 'if is in [IDField] then msgbox "this record already exists"?
Aug 9 2008, 09:28 AM
You can use the DCount() function along the lines of..........
If DCount("*","[NameOfYourTableToCheck]", "[IDField] = " & SomeID) > 0 Then
Msgbox "This record already exists", vbOKOnly + vbExclamation, "Duplicate Record"
Aug 9 2008, 10:00 AM
thanks , will that also work if i want to se if there is a combination of id's? for example if ID1 and ID2 are in the same record?
Aug 9 2008, 10:03 AM
Yes, you can use multiple criteria - eg
If DCount("*","[NameOfYourTableToCheck]", "[IDField] = " & SomeID & " AND [OtherField] = " & SomeOtherFiled) > 0 Then
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please