Dlookup #error #name

G

Guest

I have a form with a tab control which houses 3 subforms. On one of the
subforms I have a combo box from which I pick an id number. The field beside
it has a dlookup function that should return a description based on the combo
but I can't seem to get it to work. I have an ADP front end to sql2005
backend. I have tried the following:

=dlookup("[description]", "tabletolookin", "[Fieldinlookuptable] =
[comboname]")
=dlookup("[description]", "tabletolookin", "[filtbl] =" & forms![comboname]")
=dlookup("[description]", "tabletolookin", "[filtbl] = " &
forms![subform].form![comboname]")
=dlookup("[description]", "tabletolookin", "[filtbl] = form.[comboname]")


HELP!
 
G

Guest

The objects you are referencing to get the values to pass have to be outside
the quotes. It is also necessary to delimit the value being passed based on
the data type of the domain field:

Numeric version:
=dlookup("[description]", "tabletolookin", "[Fieldinlookuptable] = " &
[comboname])

Text version:
=dlookup("[description]", "tabletolookin", "[Fieldinlookuptable] = '" &
[comboname]) & "'"

Date version:
=dlookup("[description]", "tabletolookin", "[Fieldinlookuptable] = #" &
[comboname]) & "#"
 
G

Guest

Thank you. I used your text version but moved the ending quotes inside the
bracket.


--
Shelley


Klatuu said:
The objects you are referencing to get the values to pass have to be outside
the quotes. It is also necessary to delimit the value being passed based on
the data type of the domain field:

Numeric version:
=dlookup("[description]", "tabletolookin", "[Fieldinlookuptable] = " &
[comboname])

Text version:
=dlookup("[description]", "tabletolookin", "[Fieldinlookuptable] = '" &
[comboname]) & "'"

Date version:
=dlookup("[description]", "tabletolookin", "[Fieldinlookuptable] = #" &
[comboname]) & "#"


Dazzle said:
I have a form with a tab control which houses 3 subforms. On one of the
subforms I have a combo box from which I pick an id number. The field beside
it has a dlookup function that should return a description based on the combo
but I can't seem to get it to work. I have an ADP front end to sql2005
backend. I have tried the following:

=dlookup("[description]", "tabletolookin", "[Fieldinlookuptable] =
[comboname]")
=dlookup("[description]", "tabletolookin", "[filtbl] =" & forms![comboname]")
=dlookup("[description]", "tabletolookin", "[filtbl] = " &
forms![subform].form![comboname]")
=dlookup("[description]", "tabletolookin", "[filtbl] = form.[comboname]")


HELP!
 
G

Guest

oops!
correct syntax does make a difference :)

Dazzle said:
Thank you. I used your text version but moved the ending quotes inside the
bracket.


--
Shelley


Klatuu said:
The objects you are referencing to get the values to pass have to be outside
the quotes. It is also necessary to delimit the value being passed based on
the data type of the domain field:

Numeric version:
=dlookup("[description]", "tabletolookin", "[Fieldinlookuptable] = " &
[comboname])

Text version:
=dlookup("[description]", "tabletolookin", "[Fieldinlookuptable] = '" &
[comboname]) & "'"

Date version:
=dlookup("[description]", "tabletolookin", "[Fieldinlookuptable] = #" &
[comboname]) & "#"


Dazzle said:
I have a form with a tab control which houses 3 subforms. On one of the
subforms I have a combo box from which I pick an id number. The field beside
it has a dlookup function that should return a description based on the combo
but I can't seem to get it to work. I have an ADP front end to sql2005
backend. I have tried the following:

=dlookup("[description]", "tabletolookin", "[Fieldinlookuptable] =
[comboname]")
=dlookup("[description]", "tabletolookin", "[filtbl] =" & forms![comboname]")
=dlookup("[description]", "tabletolookin", "[filtbl] = " &
forms![subform].form![comboname]")
=dlookup("[description]", "tabletolookin", "[filtbl] = form.[comboname]")


HELP!
 

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

DLookup Expression trouble 5
DLookup in subform 11
DLookup Alternative 11
DLookUp and Continuous forms 3
Subform Reference 2
Dlookup Question 5
dlookup 1
Code not finding subforms 1

Top