DLOOKUP function problem

CosmaL

Registered User.
Local time
Today, 09:10
Joined
Jan 14, 2010
Messages
94
Hello everybody!

I've got the following problem:

In my database, i use three fields:

1. Product code (conbo box-text)
2. ClientName (text)
3. OurName (text)

The same fields are also in a table (ClientOur), so i can pull out the dlookup.

My syntax in product code after update event is the following:

Me.ClientName = (DLookup("ClientName", "ClientOur", "productcode='" & Me.ProductCode & "'"))

Me.OurName = (DLookup("OurName", "ClientOur", "productcode='" & Me.ProductCode & "'"))

I don't get any erros, only the fields in the form remain blank after update. :banghead:

Furthermore, i would like to have the same stuff in the report generated from the form.

Any ideas what's wrong?

Thank you in advance!

Best regards,
Costas
 
Is productcode a number the take away the '
Code:
"productcode=" & Me.ProductCode
Else show sample data from your table.
 
The product code is text.

Data from table:
ID (autonumber), Productcode (text with maximun 9 numerical characters), ClientName (text), OurName (Text)
1, 1234567, Paper1, Paper1
2. 1245689, Paper2, Paper2
3. 0215487, Bav, bdu
4. 0596847, Beu, Bea
5. 0569874, Dei, Deita
 
if you included the ID in the combobox, this is the default value of your combo.
so try to reference by column number:

Me.ClientName = (DLookup("ClientName", "ClientOur", "productcode='" & Me.ProductCode.Column(1) & "'"))

Me.OurName = (DLookup("OurName", "ClientOur", "productcode='" & Me.ProductCode.Column(1) & "'"))
 
...if you included the ID in the combobox, this is the default value of your combo...

Actually, as of v2007, if the Table simply has a Primary Key, the Access Gnomes will automatically include it in the Combobox, with no action (such as including it in the RowSource) needed on the user's part, make it the Bound Column, and set its width to 0" so that you don't even see it when the Combobox drops down!

Linq ;0)>
 

Users who are viewing this thread

Back
Top Bottom