>I am new to msaccess and have started building an app using wizards. I am now at a point where I need to add some coding and am not sure where to start. I currently have the user to fill in values (one of which is a unique tracking #) in a form and when they click a command button the values of the form are appended to a table. What I would like to do is check the table to see if that tracking number has been entered yet. If it has, I want to prompt the user "Record exists: Do you wish to overwrite Y/N" Yes will overwrite the values in the record; No will do nothing. If the tracking number has NOT been entered yet the existing code will add it to the table. Any help would be appreciated.
Hi Michael,
Try this:
dim nTrackingNumber as Long
...
nTrackingNumber = 125
if isnull(DLookup("TrackingNumber","tblTracking","TrackingNumber"=nTrackingNumber)) then
msgbox "Record not found"
else
msgbox "Record exists"
endif
HTH
Igor Gelin
Database Developer