Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to check for existing record
Message
 
À
24/08/2001 08:10:00
Information générale
Forum:
Microsoft Office
Catégorie:
Access
Divers
Thread ID:
00548540
Message ID:
00549209
Vues:
16
This message has been marked as the solution to the initial question of the thread.
>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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform