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

Error 2482 - I can't successfully run query from form or VBA Module

Status
Not open for further replies.

partiqle2

Programmer
Joined
Mar 28, 2003
Messages
1
Location
US
I'm creating an invoicing database for chargeback. The number of customers is not large so input of individual customers is not entirely time consuming (batch processing will be in a later version). Either way, I created an Append Query that takes in a parameter of Customer_ID. I can run the query from the queries tab, no problem. I can even hit Cancel and it's ALL GOOD. However, the INSTANT I attach it to a Command Button on a form or run it from a VBA Module, I can get the prompt from the query and input data, but the instant I hit cancel from the prompt I get the following error

ErrorCode2482

ErrorString
"[NAME OF MY DATABASE]can't find the name 'THE ACTUAL PARAMETER PROMPT' you entered in the expression.@You may have specified a control that wasn't on the current object without specifying the correct form or report context.@To refer to a control on another form or report, precede the control name with the name of a collection, usually either Forms or Reports, and the name of the form or report to which the control belongs.
For example, Forms![Products]![Units In Stock].@1@@1"

I tried to wrap it in a form via combo box, but the command button to run the query didn't even run the query!

What I want to be able to do is Cancel out of the prompt without said Error.

Please advise.

partiqle2
 
If you are trapping errors (e.g., On Error GoTo RunMyQuery_Err) in the routine that opens this query, just check for error number 2482 and use Resume Next to skip to the statement following the OpenQuery.

If you are not trapping errors, put the statement On Error Resume Next immediately before the OpenQuery statement.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top