- Local time
- Yesterday, 21:44
- Joined
- Feb 28, 2001
- Messages
- 29,976
I see the SQL in post #1 has a bunch of qualifying references to a table named "Contacts" - but RST9 is self-referential and makes no mention of table contacts in the FROM clause. Which means that [Contacts]. is essentially "dangling" syntax. You use strSQL inside the OpenRecordset of RST9 - but the problem? It is part of rst9 and yet refers to rst9. It is self-referencing. At no point is the table named "Contacts" brought into play. It would have to be in a FROM clause for you to use it to qualify the field names.
The definition for DAO requires that you have either a table name, a query name, or an SQL statement that would (potentially) return records. A SELECT would do that if it were well-formed, but due to the self-referential nature of strSQL, you cannot open that recordset. You are in essence asking it to open a recordset to itself. That just won't fly.
You could save yourself some typing if table Contacts is really your data source. That is, if you really meant to use "FROM Contacts" and no other table is involved, you can omit the qualifier prefixes. As long as it is a single source, you don't need qualifiers.
You commented that your data was already filtered. Therefore my next question is "in what way?" Because you might be able to build that string already filtered by referring to (copying) the same WHERE clause (or equivalent) that assured your proper filtration from whatever source was involved.
The definition for DAO requires that you have either a table name, a query name, or an SQL statement that would (potentially) return records. A SELECT would do that if it were well-formed, but due to the self-referential nature of strSQL, you cannot open that recordset. You are in essence asking it to open a recordset to itself. That just won't fly.
You could save yourself some typing if table Contacts is really your data source. That is, if you really meant to use "FROM Contacts" and no other table is involved, you can omit the qualifier prefixes. As long as it is a single source, you don't need qualifiers.
You commented that your data was already filtered. Therefore my next question is "in what way?" Because you might be able to build that string already filtered by referring to (copying) the same WHERE clause (or equivalent) that assured your proper filtration from whatever source was involved.