George1111
June 15th, 2009, 12:11 PM
I am trying to do the following (but the machine just locks up)
strSQL = "Select [O].[RecID], [O].[TransactionSource], [O].[AccountNumber], [S].[FullName], [O].[TransactionType], "
strSQL = strSQL & " [O].[TransactionDate], [O].[ReferenceNumber], [O].[Description], [O].[TransactionMemo], "
strSQL = strSQL & " [O].[TransactionAmountDR], [O].[TransactionAmountCR], "
strSQL = strSQL & " [O].[CreatedByOpID], [O].[DataWarehouseUpdated], [O].[TransactionAllocation] "
strSQL = strSQL & " from ITM_Transactions [O], Members [S] Where [O.AccountNumber] = [S.CardNumber] "
strSQL = strSQL & " and O.TransactionType = 51 OR O.TransactionType = 65 "
strSQL = strSQL & "and O.TransactionDate Between #" & ChkDateFrom & "# and #" & ChkDateTo & "# "
strSQL = strSQL & "order by O.AccountNumber, O.TransactionDate"
If I remove the code in RED it will work OK
The problem seems to be caused by the OR Statement - basically I want all transactions which have a transaction type of 51 or 65 with the other account and date criteria selected as well
???
JUST ENTERED MY HEAD TO PUT BRACKETS AROUND
and (O.TransactionType = 51 OR O.TransactionType = 65 )
AND IT WORKS !!!!!
strSQL = "Select [O].[RecID], [O].[TransactionSource], [O].[AccountNumber], [S].[FullName], [O].[TransactionType], "
strSQL = strSQL & " [O].[TransactionDate], [O].[ReferenceNumber], [O].[Description], [O].[TransactionMemo], "
strSQL = strSQL & " [O].[TransactionAmountDR], [O].[TransactionAmountCR], "
strSQL = strSQL & " [O].[CreatedByOpID], [O].[DataWarehouseUpdated], [O].[TransactionAllocation] "
strSQL = strSQL & " from ITM_Transactions [O], Members [S] Where [O.AccountNumber] = [S.CardNumber] "
strSQL = strSQL & " and O.TransactionType = 51 OR O.TransactionType = 65 "
strSQL = strSQL & "and O.TransactionDate Between #" & ChkDateFrom & "# and #" & ChkDateTo & "# "
strSQL = strSQL & "order by O.AccountNumber, O.TransactionDate"
If I remove the code in RED it will work OK
The problem seems to be caused by the OR Statement - basically I want all transactions which have a transaction type of 51 or 65 with the other account and date criteria selected as well
???
JUST ENTERED MY HEAD TO PUT BRACKETS AROUND
and (O.TransactionType = 51 OR O.TransactionType = 65 )
AND IT WORKS !!!!!