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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DLOOKUP SYNTAX 1

Status
Not open for further replies.

mgbeye

Programmer
May 30, 2001
47
US
I have set up a dlookup function, but it keeps returning an error message.
Code:
Me.PF_size = DLookup("[preform_size]", "Preform to Bottle SF and Preform Usage", "[Bottle IMS] =" & Me.bottleIMS)

PF_size is the name of the txtbox I want it displayed in
Preform_size is the field I want returned from the table
Preform to bottle... is the table name
[bottle IMS] is the field name in the table
bottleims is the txtbox name

Can anyone help???

Thanks :cool:
 
are you sure that [bottle ims] and me.bottleims are the same data type? Mary :)

Rule 1: Don't sweat the small stuff.
Rule 2: EVERYTHING is small stuff!! X-)
 
that doesnt seem to be the problem. They are both set as text. Any other suggestions?

 
What exactly is the error message??? Mary :)

Rule 1: Don't sweat the small stuff.
Rule 2: EVERYTHING is small stuff!! X-)
 
It also may be having a problem with the table name. Spaces can confuse it sometimes. Mary :)

Rule 1: Don't sweat the small stuff.
Rule 2: EVERYTHING is small stuff!! X-)
 
This is the error message.

"Run-time error '64479'
The expression you entered as a query parameter produced this error. 'The object doesn't contain the Automation object 'BOT30026'."


BOT30026 is a valid bottle IMS.

Thanks again :)
 
Try creating a variable and point the form's field data to it and use it instead in the syntax. Mary :)

Rule 1: Don't sweat the small stuff.
Rule 2: EVERYTHING is small stuff!! X-)
 
You need single quotes because of the data type being returned (text). Try this:

[tt]
Me.PF_size = DLookup("[preform_size]", "Preform to Bottle SF and Preform Usage", "[Bottle IMS] = '" & Me.bottleIMS & "'")
[/tt]

HTH


Joe Miller
joe.miller@flotech.net
 
Joe is right. I didn't even see that before (ah.. the little things!) *G* Mary :)

Rule 1: Don't sweat the small stuff.
Rule 2: EVERYTHING is small stuff!! X-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top