Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open a recordset fro a query

Status
Not open for further replies.

AmritPaulSingh

Programmer
Dec 5, 2002
46
CA
Hi
I am able to open the recordset for a table. But how do I open it for a query...a query that I created using another query.
The code I use is:
rs.open "[qryQueryName]", conn, 1

The above code works just fine if I replace the query with an existing table.
Any suggestions?
 
Hello
Check this code out and see if it helps. I am not sure why it would come back with a table to test for success, use the code at the bottom.

Dim conDB As New ADODB.Connection
Dim rstDB As New ADODB.Recordset
Dim strSQL As String

conDB.Open "DSN=" & sDSN & ";UID=" & sUID & ";PWD=" & sPSWD

strSQL = "select stuff"

rstDB.Open strSQL, conDB

if rstdb.eof = true and rstdb.bof =true then
msgbox "Your Recordset is empty"
end if
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top