View Single Post
  #14  
Old May 22nd, 2008, 08:14 PM posted to microsoft.public.access.forms
ridgerunner
external usenet poster
 
Posts: 118
Default Check For Existing Record

Thanks. After looking at the example, I changed a few things and I am not
receiving any error messages but the "trap" is failing. Closer examination
causes me to ask if the = 'frmAddDMInspections![InspDate]'")) is
correct since it only refers to the InspDate? I am going to try Doug's
example when I find out where to put the Function.


Private Sub InspDate_BeforeUpdate(Cancel As Integer)

If Not IsNull(DLookup("[NoDuplicates]", "qryFrmAddDMInsp", "[NoDuplicates]=
'frmAddDMInspections![InspDate]'")) Then
MsgBox "Store and Inspection Date already exist. Please correct",
vbCritical, "Duplicate Entry"
End If
Exit Sub


End Sub

"ruralguy via AccessMonster.com" wrote:

All arguments to Domain functions need to be strings. Here's a good reference:

http://www.mvps.org/access/general/gen0018.htm

ridgerunner wrote:
I am getting this message "Runtime error 424" "Object Required". The second
and third lines, below, are highlighted in the debug screen.


Private Sub InspDate_BeforeUpdate(Cancel As Integer)

If Not IsNull(DLookup("[NoDuplicates]", (qryFrmAddDMInsp), "[NoDuplicates]="
& frmAddDMInspections![InspDate])) Then
MsgBox "Store and Inspection Date already exist. Please correct",
vbCritical, "Duplicate Entry"
End If
Exit Sub

End Sub

Here is my solution for multiple field duplication. I first join the two
fields in a query. For your example I would do this in a query.

[quoted text clipped - 28 lines]
tia
ridgerunner


--
RuralGuy (RG for short) aka Allan Bunch MS Access MVP - acXP WinXP Pro
Please post back to this forum so all may benefit.

Message posted via http://www.accessmonster.com