Check on existance

L

Lodewijk

For my school I have to serach for new adressess with all undeliverable
newsletters. For that purpose I put all the old adressess in a database. The
index is a number given by the sender. When entering the adresse, I am
prompted to give the number. Before I want to continue, I want to know if
the number is allready in the database. How can I do that?

Before I enter a new record, the following is asked:

intNumber = InputBox(strPrompt, strTitel, 0) ' To enter the number for
the record
If intNumber = 0 Then
' Stop with adding new records
Else
' Add new record
' At this point, I want to check if intNumber does not excists in
the database
EndIf
 
D

Douglas J. Steele

You could use DLookup to retrieve some field from your table: if null is
returned, you can assume that the record doesn't exist. Alternatively, you
could use DCount to determine how many records exist in the table with that
ID.
 
L

Lodewijk Olthof

DLookup did the trick, thanks
Douglas J. Steele said:
You could use DLookup to retrieve some field from your table: if null is
returned, you can assume that the record doesn't exist. Alternatively, you
could use DCount to determine how many records exist in the table with that
ID.
 
Top