View Single Post
  #1  
Old May 14th, 2010, 05:09 PM posted to microsoft.public.access.forms
Darrell Childress[_3_]
external usenet poster
 
Posts: 32
Default Trying to use DLookup

I have a table (tblSO_Items, this is my master table containing all
items) which contains the following fields
Number (this is a number field)
sono (text field)
lineno (text field)

I am entering data on a form into a separate table (tblProgressReport).
Here's what I would like to be able to do: After entering the sono and
lineno, I would like to have the form look in the tblSO_Items table and
automatically pull the contents of the Number field on the form. I know
this should be possible with the DLookup function, but I cannot get it
to work. Here's what I have in the AfterUpdate event of the lineno field
on the form:

Number = DLookup("[Number]", "tblSO_Items", "[sono]=(' &
Forms![sbfProgressReport]![sono] & ') And [lineno]=(' &
Forms![sbfProgressReport]![lineno] & ')")

But it does nothing. If I edit the above to be:
Number = DLookup("[Number]", "tblSO_Items", "[sono]='82003' And
[lineno]='13'") -- what I did here was enter an actual sono and lineno,
then it works perfectly and populates the Number field with the Number
field from tblSO_Items

Any help would be greatly appreciated, or if there is another way of
doing this.
Darrell