Dlookup help

Gazza2

Registered User.
Local time
Today, 13:58
Joined
Nov 25, 2004
Messages
184
Im having a strange problem with my dlookup.

heres the code:-
Me.description = DLookup("[description]", "table2", "[partno] = '" & Me.PartNo & "'")

basically this is in the afterupdate of the partNo text box and when i enter a part no it brings up the description of the first record only no matter what part no i enter.Can anyone see a problem with the code.
 
yes it is a text field
 
I think it should work though having Table2 as part of your MainForm query would eliminate the DLookup() requirement.
 
the problem is that if i use a query then it shows all the records from the table in the subform and i dont want that.I want to be able to enter a part no and bring up the details in the other text boxes and then move to the next line.
 
Any chance you can post your db with any sensitive data removed but with enough sample data to demonstrate the problem?
 
Your code is incorrect.
You're referring to a non-existing column partno whereas your column is named Part No

Change your code into

Code:
Me.description = DLookup("[description]", "table2", "[Part No] = '" & Me.PartNo & "'")

RV
 
ok now that works the next major headache im having is i cant add more than one line for some reason.

If i enter a part no into the text box it fills in all the details and goes to the quantity text box and after i enter a quantity it wont go to the next line it just returns to the part no text box on the same line.

The subform is set to continuous andit shows a blank record underneath the first line but i cant get it to go there.

Can someone point me in the right direction as no-one else seems to have this problem after reading the thousands of posts on here.

Thanks.
 
Check the Cycle property of the subform.
 
the cycle property is set to all records but i have tried it with current record and current page but it makes no difference.
 

Users who are viewing this thread

Back
Top Bottom