DLookUp - Sub form

J

jer

I have a form frmConfirmationDetails with the below
control which works

=DLookUp("Category","tblCategory","CategoryId=Forms!
[frmConfirmationDetails]!CategoryId")

I have included frmConfirmtionDetails as
a sub-form in frmRequest. I am getting an error with the
dlookup functon. I have looked at the help files and
come up with

=DLookUp("Category","tblCategory","CategoryId=Forms!
frmRequest!Confirmation Details.Form!CategoryId")

where "Confirmation Details" is the name for the
frmConfirmationDetails control in the frmRequest. But I
am still getting an error
Could anybody say what is wrong with this
TIA
jer
 
T

Trias

Hi,

the error came from the 'WHERE' part of dlookup ("CategoryID=Forms!
frmRequest!Confirmation Details.Form!CategoryId"). What you want is to supply the value not the name of the control. Try this one:
if CategoryId is numeric:
=DLookUp("Category","tblCategory","CategoryId=" & Forms!frmRequest!Confirmation Details.Form!CategoryId)

if CategoryID is string/text:
=DLookUp("Category","tblCategory","CategoryId='" & Forms!frmRequest!Confirmation Details.Form!CategoryId & "'")

HTH

----- jer wrote: -----

I have a form frmConfirmationDetails with the below
control which works

=DLookUp("Category","tblCategory","CategoryId=Forms!
[frmConfirmationDetails]!CategoryId")

I have included frmConfirmtionDetails as
a sub-form in frmRequest. I am getting an error with the
dlookup functon. I have looked at the help files and
come up with

=DLookUp("Category","tblCategory","CategoryId=Forms!
frmRequest!Confirmation Details.Form!CategoryId")

where "Confirmation Details" is the name for the
frmConfirmationDetails control in the frmRequest. But I
am still getting an error
Could anybody say what is wrong with this
TIA
jer
 
J

jer

Trias, thanks much
jer
-----Original Message-----
Hi,

the error came from the 'WHERE' part of dlookup ("CategoryID=Forms!
frmRequest!Confirmation Details.Form!CategoryId").
What you want is to supply the value not the name of the
control. Try this one:
if CategoryId is numeric:
=DLookUp("Category","tblCategory","CategoryId=" & Forms!
frmRequest!Confirmation Details.Form!CategoryId)
if CategoryID is string/text:
=DLookUp("Category","tblCategory","CategoryId='" & Forms!
frmRequest!Confirmation Details.Form!CategoryId & "'")
HTH

----- jer wrote: -----

I have a form frmConfirmationDetails with the below
control which works

=DLookUp("Category","tblCategory","CategoryId=Forms!
[frmConfirmationDetails]!CategoryId")

I have included frmConfirmtionDetails as
a sub-form in frmRequest. I am getting an error with the
dlookup functon. I have looked at the help files and
come up with

=DLookUp("Category","tblCategory","CategoryId=Forms!
frmRequest!Confirmation Details.Form!CategoryId")

where "Confirmation Details" is the name for the
frmConfirmationDetails control in the frmRequest. But I
am still getting an error
Could anybody say what is wrong with this
TIA
jer

.
 

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

Similar Threads


Top