Question : Open a recordset using DAO 3.6 in Access 2003

Hi,
Could anybody enlight my ignorance?
I am opening an Access application, that was initially developed with Access 2000, by using an
Access 2003 version.
In this application I try to write code to get a recordset from a table.
I have the DAO 3.6 reference set.

This is a sample of the code I use:
I number the lines for reference and I use "|" as a switch between equal options.

I don't understand why I get the error 13 "Type mismatch" when I reach at line 6.

Thanks.
Andrei
Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
Private Sub Command0_Click()
 
1.Dim db1 As Database
2.Dim rs1 As Recordset
3.Dim strSQL As String
 
4.Set db1 = CurrentDb
5.strSQL = "SELECT * FROM MaterialCategory"
6.Set rs1 = db1.OpenRecordset("SELECT * FROM MaterialCategory" | strSQL, dbOpenDynaset)
 
End Sub

Answer : Open a recordset using DAO 3.6 in Access 2003

The problem is solved by mbizup's suggestion, the problem is that Recordset are in 2 references DAO and ADO and if you do not explicity say which to use it uses the one it finds from teh tom of the list, therefore you could also get round this my moving DAO up the list so it is above ADO.

Cheers, Andrew
Random Solutions  
 
programming4us programming4us