Dlookup #error #name

D

Dazzle

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!
 
K

Klatuu

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]) & "#"
 
D

Dazzle

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!
 
K

Klatuu

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

Top