Access 2002, possible to have an Access query as ADO recordset source?

  • Thread starter Thread starter Paul T.
  • Start date Start date
P

Paul T.

Is it possible to use a pre-built Access query as the source of an ADO
recordset without having to recreate the SQL text in a string? I have a
complex query that I don't know will translate very well if I try to redo
the query in code. I have tried a bunch of different ways and have had no
luck. I think it's possible in DAO, but I was wondering why it was so
difficult to figure out in ADO (if it's even possible).

Any help is greatly appreciated. I am at a loss a the moment.
 
Have you tried using the name of the query instead of an SQL text string?

--
Ken Snell
<MS ACCESS MVP>
Paul T. said:
Is it possible to use a pre-built Access query as the source of an ADO
recordset without having to recreate the SQL text in a string? I have a
complex query that I don't know will translate very well if I try to redo
the query in code. I have tried a bunch of different ways and have had no
luck. I think it's possible in DAO, but I was wondering why it was so
difficult to figure out in ADO (if it's even possible).

Any help is greatly appreciated. I am at a loss a the moment.




----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption
=---
 
Thank you for your reply. Yes, I believe I have tried what you suggest.

Here is what I've tried:

Query name in Access: qryTest

Method 1:

With myRS
.Source = "select * from qryTest"
....
End With

Method 2:

With myRS
.Source = qryTest
....
End With

Method 3:

With myRS
.Source = "qryTest"
....
End With

For me, all 3 methods failed.
 
Did you actually OPEN the recordset after setting its .Source property? That
is, you do

Either

RecordSet1.ActiveConnection=objConnection
RecordSet1.Source="SELECT * FROM query1"
RecordSet1.Open

Or

RecordSet1.Open "SELECT * FROM query1", objConnection

Paul T. said:
Thank you for your reply. Yes, I believe I have tried what you suggest.

Here is what I've tried:

Query name in Access: qryTest

Method 1:

With myRS
.Source = "select * from qryTest"
...
End With

Method 2:

With myRS
.Source = qryTest
...
End With

Method 3:

With myRS
.Source = "qryTest"
...
End With

For me, all 3 methods failed.







----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption
=---
 
Is this a select query or an action query?

--
Brendan Reynolds (MVP)
(e-mail address removed)


Paul T. said:
Thank you for your reply. Yes, I believe I have tried what you suggest.

Here is what I've tried:

Query name in Access: qryTest

Method 1:

With myRS
.Source = "select * from qryTest"
...
End With

Method 2:

With myRS
.Source = qryTest
...
End With

Method 3:

With myRS
.Source = "qryTest"
...
End With

For me, all 3 methods failed.







----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption
=---
 
Post more of the code so that we can see all that is being done.

--
Ken Snell
<MS ACCESS MVP>
Paul T. said:
Thank you for your reply. Yes, I believe I have tried what you suggest.

Here is what I've tried:

Query name in Access: qryTest

Method 1:

With myRS
.Source = "select * from qryTest"
...
End With

Method 2:

With myRS
.Source = qryTest
...
End With

Method 3:

With myRS
.Source = "qryTest"
...
End With

For me, all 3 methods failed.







----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption
=---
 
Back
Top