Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help with DLookup function for Access2003 1

Status
Not open for further replies.

Spruce4U

Technical User
Feb 1, 2006
23
CA
I cannot Dlookup function on a calculated control.

When I use the following line associated with a control event in Visual Basic, it works perfectly well:

VariableAm = DLookup("[sequence5_3_amorce]", "Liste_amorces", "[id_amorce]=" & Me![amorce_fwd])

However, when I try the same command line in the expression generator of the control (control source property), the generator tells me there is a syntax error in the expression:

=DLookup("[sequence5_3_amorce]", "Liste_amorces", "[id_amorce]=" & Me![amorce_fwd])

Could someone please help me with this?

Many thanks,

Sébastien
 
=DLookup("[sequence5_3_amorce]", "Liste_amorces", "[id_amorce]=" & [amorce_fwd])

The Me! doesn't belong in control sources only VBA.
 
Thanks for the fast answer lameid, but even when I simplify the expression to any of the following, it won’t let me enter it (still a ‘syntax’ problem):

=DLookup("[sequence5_3_amorce]", "Liste_amorces", "[id_amorce]=100")
=DLookup("[sequence5_3_amorce]", "Liste_amorces", "[id_amorce]="&100)
=DLookup("[sequence5_3_amorce]", "Liste_amorces", "[id_amorce]=’"&100&"’")


???
 
Seems id_amorce is a string

=DLookup("[sequence5_3_amorce]", "Liste_amorces", "[id_amorce]='" & [amorce_fwd] & "'")


=DLookup("[sequence5_3_amorce]", "Liste_amorces", "[id_amorce]='100'")


-Pete
 
No, it still won't work. Thanks nevertheless...
 
Add a control that just has amorce_fwd as the control source... Maybe it's value is causing problems. Maybe it is null, the wrong datatype, etc.?

Also, you are including the equal sign as part of the control source right?

Why dlookup? Would a combo box or a join work easier?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top