Hello experts.
I am having a problem with my queries producing inconsistent results. They are part of a button on an Access form.
When I change the first select line to:
SELECT ORHDR.Ordno FROM ORHDR WHERE
It works fine but when I select wildcard or multiple fields it gives me incorrect values of 1.
SELECT ORHDR.* FROM ORHDR WHERE
SELECT ORHDR.Ordno, ORHDR.Orddate FROM ORHDR WHERE
The full query:
OrdersSQL = "SELECT ORHDR.Ordno FROM ORHDR WHERE" & _
"(ORHDR.Custkey='" & CompanyID & "') and " & _
"((ORHDR.Orddate >= '" & SDate & "' ) and (ORHDR.Orddate <= '" & EDate & "')) and " & _
"(ORHDR.Custpono LIKE 'CONS%') "
OrderSet.Open OrdersSQL, colmarSource2, adOpenStatic
MsgBox "OrderSet: " & OrderSet.RecordCount
OrderSet.Close
The same problem occurred when I selected the order lines as well but now works correctly with multiple values. Which seems to be the opposite behviour of the problem I described above.
LineSetSQL = "SELECT ORLIN.Origlinsq, ORLIN.ItemKey , ORLIN.Qtyship , ORLIN.Ordno , ORLIN.Qtyship " & _
" FROM ORLIN WHERE (ORLIN.Ordno = '" & OrderSet!Ordno & "')"
LineSet.Open LineSetSQL, colmarSource2, adOpenStatic
The inconsistency makes me go crazy! I thank anyone who looks or replies for your time and attention.
Regards,
Callum
I am having a problem with my queries producing inconsistent results. They are part of a button on an Access form.
When I change the first select line to:
SELECT ORHDR.Ordno FROM ORHDR WHERE
It works fine but when I select wildcard or multiple fields it gives me incorrect values of 1.
SELECT ORHDR.* FROM ORHDR WHERE
SELECT ORHDR.Ordno, ORHDR.Orddate FROM ORHDR WHERE
The full query:
OrdersSQL = "SELECT ORHDR.Ordno FROM ORHDR WHERE" & _
"(ORHDR.Custkey='" & CompanyID & "') and " & _
"((ORHDR.Orddate >= '" & SDate & "' ) and (ORHDR.Orddate <= '" & EDate & "')) and " & _
"(ORHDR.Custpono LIKE 'CONS%') "
OrderSet.Open OrdersSQL, colmarSource2, adOpenStatic
MsgBox "OrderSet: " & OrderSet.RecordCount
OrderSet.Close
The same problem occurred when I selected the order lines as well but now works correctly with multiple values. Which seems to be the opposite behviour of the problem I described above.
LineSetSQL = "SELECT ORLIN.Origlinsq, ORLIN.ItemKey , ORLIN.Qtyship , ORLIN.Ordno , ORLIN.Qtyship " & _
" FROM ORLIN WHERE (ORLIN.Ordno = '" & OrderSet!Ordno & "')"
LineSet.Open LineSetSQL, colmarSource2, adOpenStatic
The inconsistency makes me go crazy! I thank anyone who looks or replies for your time and attention.
Regards,
Callum