GPSPOW
asked on
Setting a SQL Date parameter in a Where clause
I am creating a VBA Access SQL statement to use two stored date variables to create a where clause parameter.
Can someone help me with the syntax?
Here is the code snippet.
If Month(Date) = 1 Then
DateTo = Format((DateSerial(Year(Da te), 1, 1) - 1), "mm/dd/yyyy")
DateFrom = Format(DateSerial(Year(Dat e) - 1, 12, 1), "mm/dd/yyyy")
Else
DateTo = Format(DateSerial(Year(Dat e), Month(Date), 1) - 1, "mm/dd/yyyy")
DateFrom = Format(DateSerial(Year(Dat e), Month(Date) - 1, 1), "mm/dd/yyyy")
End If
"WHERE (((dbo_BarBillsProration.I nsuranceOr derID)='1' ) AND ((dbo_BarBills.Status)='PO STED') AND ((dbo_BarBills.Type)='FINA L') AND " & _
"((dbo_BarBills.EffectiveD ateTime) Between " & DateTo & "And " & DateFrom & ")) " &
Thanks
Glen
_
Can someone help me with the syntax?
Here is the code snippet.
If Month(Date) = 1 Then
DateTo = Format((DateSerial(Year(Da
DateFrom = Format(DateSerial(Year(Dat
Else
DateTo = Format(DateSerial(Year(Dat
DateFrom = Format(DateSerial(Year(Dat
End If
"WHERE (((dbo_BarBillsProration.I
"((dbo_BarBills.EffectiveD
Thanks
Glen
_
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.