Original Post
Ok in Acess2000 VB I want to run an SQL query and find out if it returns any rows. So I''m using this code
The access help file says you can use an sql statement as the source argument for the open method in a recordset object, which is what I have done above. The SQL variable added to the "SELECT * FROM [tManufacturers] " is just a load of filtering stuff (WHERE [Name] LIKE ''A*'' etc) which gets worked out automatically. When there is no filtering stuff to add on so the SQL statment passed to the open function is just
"SELECT * FROM [tManufacturers] "
it returns all the rows from tManufacturers as it should and so Rs.EOF = false. Now when it adds in the filtering stuff, the SQL string, it always returns 0 rows, Rs.EOF = true. Using the debugger I got the SQL statement it was passing and put in a query using the SQL view and the query works fine so it is obviously valid SQL. So if it is valid SQL that returns rows why doesn''t it when I try to use it to open I recordset like that?
dim Rs as New Recordset
....
Rs.Open "SELECT * FROM [tManufacturers] " + SQL, CurrentProject.Connection, adOpenStatic, adLockReadOnly
If (Rs.EOF <> True) Then