CCIDBMNG
Registered User.
- Local time
- Today, 07:41
- Joined
- Jan 25, 2002
- Messages
- 154
Without getting into full details can anyone by looking at the following sql statement tell me where the syntax error is...
a$ = "SELECT [First Choice].ID, [Res Rep Volume].SSN, [Res Rep Volume].Net, [First Choice].Type, [First Choice].[Product Code] FROM [First Choice] RIGHT JOIN [Res Rep Volume] ON [First Choice].[Rep SSN] = [Res Rep Volume].SSN" & _
"WHERE ((([First Choice].Type)='Sale' Or ([First Choice].Type)='resubmit') AND (([First Choice].[Product Code])='RFC') AND (([First Choice].[Order Date])<=" & [Forms]![EnterPayDate]![txtWritten] & ") AND (([First Choice].[Status 1]) Like" & _
[Forms]![EnterPayDate]![txtOddDate] & ") AND (([First Choice].[Received Date])<=" & [Forms]![EnterPayDate]![txtReceived] & ")) OR ((([First Choice].Type)='Sale' Or ([First Choice].Type)='resubmit') AND (([First Choice].[Product Code])='RFC')" & _
"AND (([First Choice].[Order Date])<=" & [Forms]![EnterPayDate]![txtWritten] & ") AND (([First Choice].[Received Date])<=" & [Forms]![EnterPayDate]![txtReceived] & ") AND (([First Choice].[Status 2]) Like " & [Forms]![EnterPayDate]![txtOddDate] & "))" & _
"OR ((([First Choice].Type)='Sale' Or ([First Choice].Type)='resubmit') AND (([First Choice].[Product Code])='RFC') AND (([First Choice].[Order Date])<=" & [Forms]![EnterPayDate]![txtWritten] & ") AND (([First Choice].[Received Date])<=" & _
[Forms]![EnterPayDate]![txtReceived] & ") AND (([First Choice].[Status 3]) Like " & [Forms]![EnterPayDate]![txtOddDate] & "));"
Any help would be greatly appreciated. I am not very good at SQL statements. I copied this from the SQL view of my query and added the quotes where I thought they were needed for it to run in my code.
Thanks in advance.
a$ = "SELECT [First Choice].ID, [Res Rep Volume].SSN, [Res Rep Volume].Net, [First Choice].Type, [First Choice].[Product Code] FROM [First Choice] RIGHT JOIN [Res Rep Volume] ON [First Choice].[Rep SSN] = [Res Rep Volume].SSN" & _
"WHERE ((([First Choice].Type)='Sale' Or ([First Choice].Type)='resubmit') AND (([First Choice].[Product Code])='RFC') AND (([First Choice].[Order Date])<=" & [Forms]![EnterPayDate]![txtWritten] & ") AND (([First Choice].[Status 1]) Like" & _
[Forms]![EnterPayDate]![txtOddDate] & ") AND (([First Choice].[Received Date])<=" & [Forms]![EnterPayDate]![txtReceived] & ")) OR ((([First Choice].Type)='Sale' Or ([First Choice].Type)='resubmit') AND (([First Choice].[Product Code])='RFC')" & _
"AND (([First Choice].[Order Date])<=" & [Forms]![EnterPayDate]![txtWritten] & ") AND (([First Choice].[Received Date])<=" & [Forms]![EnterPayDate]![txtReceived] & ") AND (([First Choice].[Status 2]) Like " & [Forms]![EnterPayDate]![txtOddDate] & "))" & _
"OR ((([First Choice].Type)='Sale' Or ([First Choice].Type)='resubmit') AND (([First Choice].[Product Code])='RFC') AND (([First Choice].[Order Date])<=" & [Forms]![EnterPayDate]![txtWritten] & ") AND (([First Choice].[Received Date])<=" & _
[Forms]![EnterPayDate]![txtReceived] & ") AND (([First Choice].[Status 3]) Like " & [Forms]![EnterPayDate]![txtOddDate] & "));"
Any help would be greatly appreciated. I am not very good at SQL statements. I copied this from the SQL view of my query and added the quotes where I thought they were needed for it to run in my code.
Thanks in advance.