Cant Find Object

IkeK

New member
Local time
, 21:32
Joined
Jan 11, 2024
Messages
4
Hello All.

I created a view in SQL that can be viewed in Access ADP.

I want to email this view.

I have a simple docmd line that should work, but the error I get is below. The strange thing is that Access is adding a one to Query name. I tried assigning it to a variable and I get the same thing. Below is the screen shot of the error and code I am typing in the immediate window to test.

docmd.SendObject acSendQuery ,"CurtisDrayageInvoiceEmail", acFormatXLSX,"test@email.com"

1705002332673.png
 
Compare the line of text you typed to the error message. Your code is different from what you posted.
I dont see what you are reffering to. The queryName is hard Coded as "CurtisDrayageInvoiceEmail" the error is coming back "CurtisDrayageInvoiceEmail1" . it appears the system is adding a 1 to the query name.
 
Have you tried another query just as a debug step?
That syntax works fine for me?
 
Look at your code. If you don't see the 1, then there is probably some corruption. Delete the line of code. Do a Decompile. Then retype the code.
 
The decompile is an undocumented argument. It was used by the developers of Access to help them to clean up their work. Compact & Repair does not completely clear out the p-code for some reason. When you compile the application, a thing called p-code is created. This is what the interpreter uses to run your VBA code. VBA is not a compiled language. It is interpreted. Sometimes the p-code becomes corrupted. There are only two ways to solve the problem. 1. create a new empty database and import all objects and settings. 2. decompile.

 

Users who are viewing this thread

Back
Top Bottom