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

dlookup 1

Status
Not open for further replies.

jommyjet

Technical User
May 19, 2003
49
US
I'm trying to assign a variable as an integer and I'm getting a runtime error that
the parameter query produced an error 'the object doesn't contain the automation object 'Apr2003."
Apr2003 is a record in the table I'm looking up, but I wonder what the period or double quotes is afterward. I'm trying to assign loopcount1 as follows where begindate is the combobox name
loopcount1 = DLookup("[id]", "monthlist", "[shortmonth] = " & begindate)
Do I need to trim begindate? I tried using a left function, but this produced the same error.
thanks
 
Jommyjet,

Date values must be enclosed within hash characters, so try:

loopcount1 = DLookup("[id]", "monthlist", "[shortmonth] = #" & begindate & "#")

John
 
Though the field has the name shortdate, it's really a text field, ex Apr2003. Begindate is a selection from shortdate. I guess bad naming convention. thanks John
 
If begindate is a text value, then use:

loopcount1 = DLookup("[id]", "monthlist", "[shortmonth] = '" & begindate & "'")

as text values must be delimited with apostrophes or double quotes.

John
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top