DLookup problem

T

Tony Williams

I have a control on a form that has as its record source the following
DLookup
=DLookUp("[txtfirstname]","[tblindividual]","[txtmemnumber]=Forms![frmcomplaint].[txtmemnbr]")

Although this seems to work when I look at the form in design mode there is
an asterix against the control and the message is Invalid Control
Property:Control Source and it also says Circular reference. Anyone tell me
what might be wrong?
Thanks
Tony
 
G

Guest

The reference to the form control has to be outside the quotes.
=DLookUp("[txtfirstname]","[tblindividual]","[txtmemnumber]= '" &
Forms![frmcomplaint].[txtmemnbr] & "'")

The syntax above assumes [txtfirstname] is a text field.
 
G

Guest

Thanks but got #Error with that ?
Tony
Klatuu said:
The reference to the form control has to be outside the quotes.
=DLookUp("[txtfirstname]","[tblindividual]","[txtmemnumber]= '" &
Forms![frmcomplaint].[txtmemnbr] & "'")

The syntax above assumes [txtfirstname] is a text field.

--
Dave Hargis, Microsoft Access MVP


Tony Williams said:
I have a control on a form that has as its record source the following
DLookup
=DLookUp("[txtfirstname]","[tblindividual]","[txtmemnumber]=Forms![frmcomplaint].[txtmemnbr]")

Although this seems to work when I look at the form in design mode there is
an asterix against the control and the message is Invalid Control
Property:Control Source and it also says Circular reference. Anyone tell me
what might be wrong?
Thanks
Tony
 
G

Guest

That is an unusual record source for a form. It will return only one field
of one record. Is it that what you really mean is a control source for a
control? If so, I have found that it works better like this:

=DLookUp("[txtfirstname]","[tblindividual]","[txtmemnumber]= '" &
[txtmemnbr] & "'")

--
Dave Hargis, Microsoft Access MVP


Tony Williams said:
Thanks but got #Error with that ?
Tony
Klatuu said:
The reference to the form control has to be outside the quotes.
=DLookUp("[txtfirstname]","[tblindividual]","[txtmemnumber]= '" &
Forms![frmcomplaint].[txtmemnbr] & "'")

The syntax above assumes [txtfirstname] is a text field.

--
Dave Hargis, Microsoft Access MVP


Tony Williams said:
I have a control on a form that has as its record source the following
DLookup
=DLookUp("[txtfirstname]","[tblindividual]","[txtmemnumber]=Forms![frmcomplaint].[txtmemnbr]")

Although this seems to work when I look at the form in design mode there is
an asterix against the control and the message is Invalid Control
Property:Control Source and it also says Circular reference. Anyone tell me
what might be wrong?
Thanks
Tony
 

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