TommyF
Technical User
- Oct 28, 2001
- 104
I am trying to bring up in a list box all the records that have yes in the onstop record and with the date between 2 certain dates with the following code
Dim wh As Date
Dim da As Date
wh = Format(DateAdd("d", -3, Date), "dd-mm-yyyy")
da = Format(Date, "dd-mm-yyyy")
Me.List39.RowSource = _
"SELECT DISTINCT Name, dt FROM Customers " & _
"WHERE onstop = yes AND dt between #" & wh & "# AND #" & da & "#"
It does not seem to work as it should as it seems to bring up dates before wh by over a month.
If I change the wh and da for actual dates then it works ok.
Any Ideas
Dim wh As Date
Dim da As Date
wh = Format(DateAdd("d", -3, Date), "dd-mm-yyyy")
da = Format(Date, "dd-mm-yyyy")
Me.List39.RowSource = _
"SELECT DISTINCT Name, dt FROM Customers " & _
"WHERE onstop = yes AND dt between #" & wh & "# AND #" & da & "#"
It does not seem to work as it should as it seems to bring up dates before wh by over a month.
If I change the wh and da for actual dates then it works ok.
Any Ideas