DoCmd.OpenQuery - receiving error that query is not found

kwagner1

Active Member
Joined
Jun 10, 2003
Messages
445
Hello,

i'm using the following code to execute a query but Access returns an error stating that my query cannot be found. It seems as if a "." is being added to the suffix of my string... WHY???? appreciate any help! (The error i receive states: Microsoft Access can't find the object 'qry MLTF total.'

Private Sub Total_Click()
On Error GoTo Err_qry
Dim MyString As String
MyString = "qry MLTF total"

DoCmd.OpenQuery MyString, , acReadOnly

' exit the subroutine
Exit_qry:
Exit Sub

Err_qry:
MsgBox Err.Description
Resume Exit_qry

End Sub
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Try renaming your query removing all the blank spaces from the name. A lot of programming codes do not like blank spaces in names of objects or fields.
 
Upvote 0
didn't amke a difference. It is being executed form a sub-form.... does that make any kind of difference.... (i wouldn't think so.... but??)
 
Upvote 0

Forum statistics

Threads
1,223,275
Messages
6,171,119
Members
452,381
Latest member
Nova88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top