DLOOKUP - can't see my error

  • Thread starter Thread starter Wendy Parry
  • Start date Start date
W

Wendy Parry

Why is DLookup so unpredictable? I have the following:

=DLookUp("PName","qryCurrentPupils","PU_SEQ='" &
Forms!frmTutorReport!PU_SEQ & "'")

which I copied from another form and just changed the form reference, I
know it works with a 'xxxx' value as I've tried that, its the control
reference that doesn't seem to work and I can't see why.

thanks for spotting an obvious error if someone sees it - is there a
better more reliable way to do this other than DLOOKUP?

Cheers

Wendy
 
Why is DLookup so unpredictable? I have the following:

=DLookUp("PName","qryCurrentPupils","PU_SEQ='" &
Forms!frmTutorReport!PU_SEQ & "'")

which I copied from another form and just changed the form reference, I
know it works with a 'xxxx' value as I've tried that, its the control
reference that doesn't seem to work and I can't see why.

thanks for spotting an obvious error if someone sees it - is there a
better more reliable way to do this other than DLOOKUP?

Cheers

Wendy

The DLookUp looks OK .... IF... the PU_SEQ field is a text datatype.

However if it is Number datatype, use:

=DLookUp("[PName]","qryCurrentPupils","[PU_SEQ] =" &
Forms!frmTutorReport![PU_SEQ])

I would suggest you get into the habit of always surrounding your
field names with brackets.
 
Back
Top