Run-time error '2766'

I'm getting the following error when I try to run a macro after a combo box updates:

Run-time error '2766':
The object doesn't contain the Automation object '|.'

"cboUpdCust" is a 2 column count combo box.  The condition in the macro is:
[tbl_Customer]![ID]=[Forms]![frm_Main]![cboUpdCust]

I wrote a query using the value from the combo box as a criteria and it worked fine...Example "ID" = 2.  Debug.Print in the Immediate Window also shows that the value is 2.  What gives?
error_proneAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

thenelsonCommented:
Convert the macro to Visual basic. Post the code of the macro and post which line causes the error.
0
error_proneAuthor Commented:
I shouldn't have to convert the macro to VB.  Here's what the after update of the combo box does:

Private Sub cboUpdCust_AfterUpdate()
   
    Me.txtCustDisplay.SetFocus
    Me.txtCustDisplay = Me.cboUpdCust & " " & Me.cboUpdCust.Column(1) & " " & Me.cboUpdCust.Column(2)
    DoCmd.RunMacro ("mcr_Upd_Customer")

End Sub

Macro "mcr_Upd_Customer" runs simple action queries with this in the condition section:
[tbl_Customer]![ID]=[Forms]![frm_Main]![cboUpdCust]
0
thenelsonCommented:
So which line in the macro is causing the error?
0
10 Tips to Protect Your Business from Ransomware

Did you know that ransomware is the most widespread, destructive malware in the world today? It accounts for 39% of all security breaches, with ransomware gangsters projected to make $11.5B in profits from online extortion by 2019.

error_proneAuthor Commented:
The condition in the macro is causing the error.  I took it out and it worked fine.  Is this not the right syntax?  
[tbl_Customer]![ID]=[Forms]![frm_Main]![cboUpdCust]

One of the macro actions this condition is on is a delete query.  So I only want the macro to delete records from tbl_Customer where the ID is equal to the value in cboUpdCust.  I know I can put it in the where clause of the sql statement, but I have multiple queries and I want to re-use objects - that's why I need to use the conditions in a macro.  
0
harfangCommented:
The condition column decides whether you run a command or you don't. It will not select records from a table for deletion. Furthermore, when evaluating the condition, there is nothing called "tbl_Customer" accessible. This would be valid only from within a query having "tbl_Customer" in its FROM clause.

You will have to write a query with the condition included, which you can then run directly using DoCmd.RunSQL instead of RunMacro.

(°v°)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
thenelsonCommented:
What action is the condition statement in? What are all the arguments of the action?
0
harfangCommented:
Even simpler: delete the customer selected in the combo box...

(°v°)
CurrentDb.Execute "DELETE FROM tbl_Customer WHERE ID=" & cboUpdCust

Open in new window

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.