Hi !
I am probably missing something very obvious here - but for now, I am just becoming crazy !
I am working on a VB6 application - talking to an Access2000 database.
I am used to this kind of application.
I worked with this specific one for about 1 year - wiht no trouble in this kind.
I've created a query in access (did this to simplify my code). This query (QUERY1) is made of 9 tables.
I am selecting a few field of those tables.
When I run this query in access - I get 1 record as a result - which is OK.
Now - when I run the query from VB - I get 0 record !
(the query is "select * from QUERY1" - no WHERE clause or other)
I checked - I typed in the correct queryname, I am talking the correct DB ...
I added a MSFlexgrid linked to a Data Object - the record is there !
This is how I run the query :
dim rs as adodb.recordset
set rs=new adodb.recordset
set rs=RunQuery("select * from query1")
function Runquery (strSQL as string) as adodb.recordset
Dim RS As ADODB.Recordset
Dim cmd As ADODB.Command
On Error GoTo ErrorHandler
Set RS = New ADODB.Recordset
Set cmd = New ADODB.Command
cmd.ActiveConnection = cnn1 'cnn1 is set at start of application
cmd.CommandText = strSQl
Set RS = New ADODB.Recordset
RS.CursorType = adOpenStatic
RS.LockType = adLockReadOnly
RS.Open cmd
Set RunSQLReturnRORS1 = RS
Set cmd = Nothing
Set RS = Nothing
Exit Function
I run queries this way since the beginning and NEVER had a problem ...
I am sure it is some stupid thing ...
I am probably missing something very obvious here - but for now, I am just becoming crazy !
I am working on a VB6 application - talking to an Access2000 database.
I am used to this kind of application.
I worked with this specific one for about 1 year - wiht no trouble in this kind.
I've created a query in access (did this to simplify my code). This query (QUERY1) is made of 9 tables.
I am selecting a few field of those tables.
When I run this query in access - I get 1 record as a result - which is OK.
Now - when I run the query from VB - I get 0 record !
(the query is "select * from QUERY1" - no WHERE clause or other)
I checked - I typed in the correct queryname, I am talking the correct DB ...
I added a MSFlexgrid linked to a Data Object - the record is there !
This is how I run the query :
dim rs as adodb.recordset
set rs=new adodb.recordset
set rs=RunQuery("select * from query1")
function Runquery (strSQL as string) as adodb.recordset
Dim RS As ADODB.Recordset
Dim cmd As ADODB.Command
On Error GoTo ErrorHandler
Set RS = New ADODB.Recordset
Set cmd = New ADODB.Command
cmd.ActiveConnection = cnn1 'cnn1 is set at start of application
cmd.CommandText = strSQl
Set RS = New ADODB.Recordset
RS.CursorType = adOpenStatic
RS.LockType = adLockReadOnly
RS.Open cmd
Set RunSQLReturnRORS1 = RS
Set cmd = Nothing
Set RS = Nothing
Exit Function
I run queries this way since the beginning and NEVER had a problem ...
I am sure it is some stupid thing ...