You get this error message when the "source" cannot be identified. It expects a table name, a query name, or a full SQL sentence, but the message assumes only the last case, which is confusing.
Anyway, the most obvious explanation is that you don't have a query named qryRoutingNotice, the most likely is that your query uses parameters (and that includes any reference to a control on a form). In that case, you need to provide the values to a command object:
<command>.Parameters(0) = Forms!Form1!Text1
For a full example, please visit:
Opening a Recordset Object by Using a Saved Query
http://msdn.microsoft.com/
Cheers!
(°v°)
Main Topics
Browse All Topics





by: boag2000Posted on 2009-10-30 at 17:33:48ID: 25707751
1. This is an Error with an SQL statement.
ication")
When you click "Debug", what line is highlighted in yellow?
If is this line:
myRecordSet.Open "[qryRoutingNotice]"
Then run the query on it's own and report what happens.
If the query runs normally then replace the name of the query with the actual SQL.
Something like this for eaxmple:
myRecordSet.Open "SELECT * FROM YourTable"
...and again report your findings.
2. You are not declaring "Outlook" as anything?
(Also I would consider changing the name to something like "appOL" throughout the code:
So I would use something like this:
Dim appOL As Outlook.Application
Set appOL= CreateObject("Outlook.Appl
I also notice that you are not closing your objects and setting them to Nothing.
Something like this:
myRecordSet.Close
Set myRecordSet=Nothing
Set appOL=Nothing
JeffCoachman