Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

checking table for existing data

Status
Not open for further replies.

ApplePirate

Programmer
Dec 16, 2002
65
GB
ok, this is what im doing:-
I have a table of customer registrations, the registrations can come from a number of sources and are loaded into the database through an input form by a number of bods.

what i want:-
is to have the primary key checked once its loaded and a message box to appear if the data already exists within the db. (also possibly to have the full record populate all of the fields within the input form.

i have tried save after update of Primary key field, but there are a number of required fields so i get the obligatory "you cant save this record at this time" message.

tried using SQL but dont know what im doing so cant work out where im going wrong.

tried using DLookUp but this doesnt seem to do anything

any help, thanks in advance





Never ever, bloody anything, ever
 
I have done this using DCount.

x = DCount("[PrimaryKey]", "[MyTable]", "[PrimaryKey]='" & SearchText & "'")
x = Nz(x, 0)
If x = 0 then
'Not in table
else
'In table
End If

Note: the above syntax is for a text field.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top