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

Run-Time Error 2471- Query Parameter

Status
Not open for further replies.

bitg07

IS-IT--Management
Jan 3, 2002
3
CA
NewOptNum = DMax"[OPTION_NUM]", "tblQuote_Options", "[QUOTE_VER]=" & Me![QUOTE_VER])+1

What's wrong with this? I am trying to automatically create a number that is 1 higher than the highest value in the table (and it works in another form). However, "[QUOTE_VER]" is a string in the format "01-5000-PE".
When I run this code I get "Runtime error 2471: The expression you entered as a query parameter produced this error:'The object doesn't contain the Automation object 'PE.''

Anybody got any suggestions?
 
You can do one of the following:

change the line to read:

NewOptNum = DMax"[OPTION_NUM]", "tblQuote_Options", "[QUOTE_VER]='" & Me![QUOTE_VER] & "'")+1

or

put a constant at the top of the module like this:

Const DBLQUOTE as String = """"

and change the line to read:

NewOptNum = DMax"[OPTION_NUM]", "tblQuote_Options", "[QUOTE_VER]=" & DBLQUOTE & Me![QUOTE_VER] & DBLQUOTE)+1


That should do the trick... Incidently, I use the DBLQUOTE constant myself, because that lets me see easier that it is a string, whereas the single quote can get lost most of the time.

GComyn
 
Thanks, that works perfectly.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top