Query then message box

jbphoenix

Registered User.
Local time
Yesterday, 19:10
Joined
Jan 25, 2007
Messages
98
I have a list box that on a double click populates a subform. But to help prevent duplicate data I would like to have a message box open based on query results. If there is already a record in the table with a matching RMA and Part_ID I want a message box to open and ask the user if they really want to add the record.
 
There is no question here. You need help with the query? Triggering the events? Cancelling the event if a dupe is identified?
Cheers
 
I have a query set up based on the RMA ID. I want the message box to open if there is a record with matching rma and part id.

I don't know how to trigger the message box if there is a matching record already in the table.
 
Nz("")

Use NZ and dlookup prior to adding the record.
Example:
Code:
Dim intRec as Integer
intRec = nz(dlookup("FieldName","tblName","[RMA_ID]=12345"),0)

If intRec > 0 then
     'There is a record
else
      'Code to add the record
end if
I use this trick all the time. Hopefully you'll understand.
 

Users who are viewing this thread

Back
Top Bottom