DLookup issue in form text box

gpbuckley

Gerry
Local time
Today, 23:05
Joined
Apr 8, 2010
Messages
16
Hi. I have been bashing around wuith this for some time now but seem to be hitting a wall. I have a database containing several tables. In the table named vendor_list there are fields vendor_nr and vendor_name - I have created a form named general_rev2 - in the form I have added a text box which I want to output the vendor_name value when I type in the vendor_nr in its field. The properties of the text box has control source:

=DLookUp("[vendor_name]","[vendor_list]","[vendor_nr]=" & Forms!general_rev2!vendor_nr)

Got the above syntax from MS Site but I am obvously doing something wrong - the value I get back is #Name?

Any ideas? Thanks a million:confused:
 
All you needed was just the field name:

Code:
=DLookUp("[vendor_name]","[vendor_list]","[vendor_nr]=" & [vendor_nr])
 
In the After Update event of the vendor_nr field put the following
me!vendor_name==DLookUp("[vendor_name]","[vendor_list]","[vendor_nr]=" & Forms!general_rev2!vendor_nr)
 
hello, i think i can use this with my project. but when i insert

Private Sub Kode_Barang_AfterUpdate()

Nama Barang = DLookup("[Nama Barang]", "[Data Stock]", "[Kode Barang]=" & [Kode Barang])

End Sub

i got error sub or function not defined.

sorry, i dont know access at all.
 
That goes in the Control Source property of Nama Barang.
 
That goes in the Control Source property of Nama Barang.

Hah, i dont know why. but after i add _ at Nama Barang = DLookup...........

it's work!

Thanks..

i have more question later :)
 
That's because if the name of your textbox contains a space, Access will want you to use an underscore to fill up that space. Spaces are not recommended in control names.

Use the Control Source instead, no need for After_Update event.

You can certainly ask more questions :) But remember to create a new thread. Good luck!
 

Users who are viewing this thread

Back
Top Bottom