Need help with Dlookup on a forms Before Update

R

Radar

Need help with DLookup in forms beforeupdate
I have a table called tblStoreOrders with a key field name [Store] ( a
numeric field)
My form name is frmStoreOrders with a combo box call "Store" (This has
all the availible store numbers)
I want to check to see if this store has already placed an on the
same date. or a duplicate record, based on the same date of entry.
I tried first just looking for the store only. no luck.

DLookup("[Store]", "[tblStoreOrders]", "[Store] =
Forms![frmstoreOrders!store]")
error Expecting =
Please Help!
 
J

John Vinson

Need help with DLookup in forms beforeupdate
I have a table called tblStoreOrders with a key field name [Store] ( a
numeric field)
My form name is frmStoreOrders with a combo box call "Store" (This has
all the availible store numbers)
I want to check to see if this store has already placed an on the
same date. or a duplicate record, based on the same date of entry.
I tried first just looking for the store only. no luck.

DLookup("[Store]", "[tblStoreOrders]", "[Store] =
Forms![frmstoreOrders!store]")
error Expecting =
Please Help!

DLookUp is a function which returns a value, in this case the value of
Store; you can't just put DLookup alone on a text line. You need to
either set a variable to the value returned:

strStore = DLookUp...

or test the value returned to see if it is NULL:

If IsNull(DLookUp(...)) Then

Also you have a syntax error with your forms reference: it should be

Forms![frmstoreOrders]![store]

John W. Vinson[MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top