lookup data from a table

  • Thread starter Thread starter JohnQ
  • Start date Start date
J

JohnQ

if i typ in the productcode in a (table based) form i want
to display the productname, which is in another table, in
a field in the same form.

If i use a query for the form i get the message "not
updateble" ( the table i get the productname from is a SQL
table).

Any help?

regards,
JohnQ
 
this code is not working

Private Sub Pcode_Exit(Cancel As Integer)
'text2 = field that must show the product name

[Text2] = DLookup
("prod_name1", "producttable", "P_name" = [Pcode])


End Sub

any help?
 
if i typ in the productcode in a (table based) form i want
to display the productname, which is in another table, in
a field in the same form.

If i use a query for the form i get the message "not
updateble" ( the table i get the productname from is a SQL
table).

Any help?

regards,
JohnQ

What datatype is the [ProductCode] field?
If it is Number datatype...
In an unbound text control on the form:
=DLookUp("[ProductName]","TableName","[[ProductCode] = " &
Me![ControlNameOnForm])

If it is Text datatype:
=DLookUp("[ProductName]","TableName","[[ProductCode] ='" &
Me![ControlNameOnform] & "'")
 
Back
Top