View Full Version : Fill Form entries based on previous record


ReneeB
10-25-2000, 06:18 AM
I reviewed responses to RossW who had the same problem and tried to us dlookup however I was unsuccessful. Please take a look at my syntax and if anyone can tell me what's wrong, I'd be most grateful. I entered the following (& a number of variations) expression in the text box's control source property: =DLookup("IID#]","Buyer Information","[BuyerID]=Forms![Form1]![IID#]")-1

IID# =my field
Buyer Information = the table in which the field "IID#" appears
BuyerID=the ID number for the "Buyer Information" table

HELP!!!!

Jack Cowley
10-25-2000, 01:44 PM
Try: =DLookup("[IID#]","[Buyer Information]","[BuyerID]= " & [Forms]![Form1]![IID#])-1

I am assuming that BuyerID is numeric and NOT text. If it is text the syntax is:
"[BuyerID]= '" & [Forms]![Form1]![IID#] & "'"

Since your code is the control source for the text box your data will not be saved in the table. If you want to save the data that DLookup finds then put the code in the Default event of the field and bind the text box to the field you want.

[This message has been edited by Jack Cowley (edited 10-25-2000).]