G
George Hester
http://msdn.microsoft.com/library/en-us/dnvbpj00/html/sqlado.asp?frame=true
In here you will see the function I am using called ExecuteSQL:
http://msdn.microsoft.com/library/en-us/dnvbpj00/html/sqladoisting.asp?frame=true
I am not using all the Forms, Command Buttons and what not. This is a very simple function which can operate on its own without all the dressing. In fact it doesn't even need to use ADODB.Recordset. It can use ADOR.Recordset as well and this is the way I am using it. For this particular example this does not matter. The problem will still occur.
If the SQL statement is such that you see here:
strSQL6 = "SELECT [" & strTblNameNonKeyed & "].[" & strFldName1 & "], [" & strTblNameNonKeyed & "].[" & strFldName2 & "] " & _
"FROM [" & strTblNameNonKeyed & "] " & _
"LEFT JOIN [" & strTblNameLinked & "] " & _
"ON [" & strTblNameNonKeyed & "].[" & strFldName2 & "] = [" & strTblNameLinked & "].[" & strFldName2 & "] " & _
"WHERE ((([" & strTblNameLinked & "].[" & strFldName2 & "]) Is Null));"
and if this SQL returns only one record (here I am comparing entries in strTblNameNonKeyed with entries in strTblNameLinked then the above function ExecuteSQL will fail. It succeeds on a SQL statement that returns 2 or more records but if the SQL statement returns less then two we have a failure. In fact it will always miss the first record that is returned from the above SQL statement. It fails to return the the records generated by this SQL statement in its entirely. Try it.
Use any SQL statement that returns more then one record and see if the result of ExecuteSQL is not one less..
In here you will see the function I am using called ExecuteSQL:
http://msdn.microsoft.com/library/en-us/dnvbpj00/html/sqladoisting.asp?frame=true
I am not using all the Forms, Command Buttons and what not. This is a very simple function which can operate on its own without all the dressing. In fact it doesn't even need to use ADODB.Recordset. It can use ADOR.Recordset as well and this is the way I am using it. For this particular example this does not matter. The problem will still occur.
If the SQL statement is such that you see here:
strSQL6 = "SELECT [" & strTblNameNonKeyed & "].[" & strFldName1 & "], [" & strTblNameNonKeyed & "].[" & strFldName2 & "] " & _
"FROM [" & strTblNameNonKeyed & "] " & _
"LEFT JOIN [" & strTblNameLinked & "] " & _
"ON [" & strTblNameNonKeyed & "].[" & strFldName2 & "] = [" & strTblNameLinked & "].[" & strFldName2 & "] " & _
"WHERE ((([" & strTblNameLinked & "].[" & strFldName2 & "]) Is Null));"
and if this SQL returns only one record (here I am comparing entries in strTblNameNonKeyed with entries in strTblNameLinked then the above function ExecuteSQL will fail. It succeeds on a SQL statement that returns 2 or more records but if the SQL statement returns less then two we have a failure. In fact it will always miss the first record that is returned from the above SQL statement. It fails to return the the records generated by this SQL statement in its entirely. Try it.
Use any SQL statement that returns more then one record and see if the result of ExecuteSQL is not one less..