Dlookup on form - help please

  • Thread starter Thread starter FatMan
  • Start date Start date
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
 
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]")
 
Possible issues:

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

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