Dlookup on form - help please

F

FatMan

Hi all:
The dlookup listed below use to work but since I changed the data type of
the "InFruitTransLog" from number to character in the table "tblIntake" it no
longers work and only displays "#Error". For the record "txtBatchNo" is a
text box on the form that the user types in a batch number and the dlookup is
suppose to lookup and return "IntakeID" from the table "tblInatke".

=DLookUp("[IntakeID]","[tblIntake]","[InFriutTransLog]= " &
[Forms]![frmPackoutDataEntry].txtBatchNo)

Can anyone please tell me what the problem is and how to correct it?

Thanks,
FatMan
 
D

Dirk Goldgar

FatMan said:
Hi all:
The dlookup listed below use to work but since I changed the data type of
the "InFruitTransLog" from number to character in the table "tblIntake" it
no
longers work and only displays "#Error". For the record "txtBatchNo" is a
text box on the form that the user types in a batch number and the dlookup
is
suppose to lookup and return "IntakeID" from the table "tblInatke".

=DLookUp("[IntakeID]","[tblIntake]","[InFriutTransLog]= " &
[Forms]![frmPackoutDataEntry].txtBatchNo)

Can anyone please tell me what the problem is and how to correct it?


Either

=DLookUp("[IntakeID]","[tblIntake]","[InFriutTransLog]= '" &
[Forms]![frmPackoutDataEntry].txtBatchNo & "'")

or

=DLookUp("[IntakeID]","[tblIntake]","[InFruitTransLog]= '" &
[Forms]![frmPackoutDataEntry].txtBatchNo & "'")

.... depending on which of your spellings of the table name is correct.

If the expression is being evaluated *on* frmPackoutData, then you don't
need the full reference to the form; you can just write:

=DLookUp("[IntakeID]","[tblIntake]","[InFruitTransLog]= '" &
[txtBatchNo] & "'")

I believe that this will also work:

=DLookUp("[IntakeID]","[tblIntake]","[InFruitTransLog]=[Forms]![frmPackoutDataEntry]!txtBatchNo]")
 
M

mike

Possible issues:

1. Is "[InFriutTransLog]" a typo?
2. You need to enclose char data in apostrophes. Try this:

"[InFriutTransLog]= '" &
[Forms]![frmPackoutDataEntry].txtBatchNo & "'"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top