Hi,
I'm trying to use code to open a select query when a button is clicked.
I'm running access 2000 & so as the select query has several nested tables, saving a pre-written query means it won't open due to 'syntax errors' (where it keeps changing ( to [ for the nested stuff). This means I would have to create several different queries to run it, or just write the query in code.
My problem is, I can't get the query results to open up using a select query written in code!
I've tried this:
Dim strSQLsel As String
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
strSQLsel = "sql code"
rs.Open strSQLsel, CurrentProject.Connection
But nothing opens. What am I doing wrong or is it not possible?
Thanks
I'm trying to use code to open a select query when a button is clicked.
I'm running access 2000 & so as the select query has several nested tables, saving a pre-written query means it won't open due to 'syntax errors' (where it keeps changing ( to [ for the nested stuff). This means I would have to create several different queries to run it, or just write the query in code.
My problem is, I can't get the query results to open up using a select query written in code!
I've tried this:
Dim strSQLsel As String
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
strSQLsel = "sql code"
rs.Open strSQLsel, CurrentProject.Connection
But nothing opens. What am I doing wrong or is it not possible?
Thanks
