dlookup right from Help not working

B

Bob Quintal

I have a Form 'frmTest DLookup' that is used to input data
into a table 'tblTest DLookup'. The table was build with a
lookup to the 'Contacts' table to provide a drop-down of
available contacts when completing the form.

The 'tblContacts' contains 'ContactName' and 'ContactEmail'
fields The 'frmTest DLookup' contains 'Contact' and 'Email'
fields used for entry into the 'tblTest DLookup'

I am trying to use DLookup to populate the 'ContactEmail'
field in the form and thus the underlying table based on the
value entered in the 'Contact' field of the same form.
This is the solution straight from the MS Help (modified w/ my
names of course):
DLookup("[ContactEmail]","[Contacts]","[ContactName] =
Forms![Contact]")

I've placed it in the Control Source of the 'ContactEmail'
field of the form. It returns #Name? in the Contact Email
field of the form. If I add an '+' at the front, the
'ContactEmail' field stays blank and can not be clicked on.

Any help on this? Another method? I've read about the SELECT
Query but am not sure where to place that.

Thanks

You need an = in front of it
=DLookup("[ContactEmail]","[Contacts]" "[ContactName] =

You will also need to put the name of the form in the criteria

Forms![What's the name of the form?]![Contact]")
 
G

Guest

I have a Form 'frmTest DLookup' that is used to input data into a table
'tblTest DLookup'. The table was build with a lookup to the 'Contacts' table
to provide a drop-down of available contacts when completing the form.

The 'tblContacts' contains 'ContactName' and 'ContactEmail' fields
The 'frmTest DLookup' contains 'Contact' and 'Email' fields used for entry
into the 'tblTest DLookup'

I am trying to use DLookup to populate the 'ContactEmail' field in the form
and thus the underlying table based on the value entered in the 'Contact'
field of the same form.
This is the solution straight from the MS Help (modified w/ my names of
course):
DLookup("[ContactEmail]","[Contacts]","[ContactName] = Forms![Contact]")

I've placed it in the Control Source of the 'ContactEmail' field of the form.
It returns #Name? in the Contact Email field of the form.
If I add an '+' at the front, the 'ContactEmail' field stays blank and can
not be clicked on.

Any help on this? Another method? I've read about the SELECT Query but am
not sure where to place that.

Thanks
 
G

Guest

When I add the '=' and the '[Form Name]!', The field does not populate with
any information and is write protected. The '#NAME?' is gone though so I
think some progress is made.

(I have verified that there is information in the 'contactEmail' field
within the 'Contacts' table.)

Bob Quintal said:
I have a Form 'frmTest DLookup' that is used to input data
into a table 'tblTest DLookup'. The table was build with a
lookup to the 'Contacts' table to provide a drop-down of
available contacts when completing the form.

The 'tblContacts' contains 'ContactName' and 'ContactEmail'
fields The 'frmTest DLookup' contains 'Contact' and 'Email'
fields used for entry into the 'tblTest DLookup'

I am trying to use DLookup to populate the 'ContactEmail'
field in the form and thus the underlying table based on the
value entered in the 'Contact' field of the same form.
This is the solution straight from the MS Help (modified w/ my
names of course):
DLookup("[ContactEmail]","[Contacts]","[ContactName] =
Forms![Contact]")

I've placed it in the Control Source of the 'ContactEmail'
field of the form. It returns #Name? in the Contact Email
field of the form. If I add an '+' at the front, the
'ContactEmail' field stays blank and can not be clicked on.

Any help on this? Another method? I've read about the SELECT
Query but am not sure where to place that.

Thanks

You need an = in front of it
=DLookup("[ContactEmail]","[Contacts]" "[ContactName] =

You will also need to put the name of the form in the criteria

Forms![What's the name of the form?]![Contact]")
 

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