Ben_Entrew
Registered User.
- Local time
- Today, 12:56
- Joined
- Dec 3, 2013
- Messages
- 177
Hi all,
I wanna check the regarding time frame of given date.
Somehow the comparison doesn't work out. pricedate is a given date selected by the USER.
I tried following:
Can anyone tell me how to write this IF statement correctly?
Thanks in advance.
Regards,
Ben
I wanna check the regarding time frame of given date.
Somehow the comparison doesn't work out. pricedate is a given date selected by the USER.
I tried following:
Code:
Public Sub TEST()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim start_date As Date, end_date As Date
Dim a As Double, c As Double
'Grap the right pricing timeframe
Set db = CurrentDb
Set rs = db.OpenRecordset("Pricing_timeframes")
Do While Not rs.EOF
If rs!Valid_from <= pricedate <= rs!Valid_to Then
start_date = rs!Valid_from
end_date = rs!Valid_to
Debug.Print pricedate
Debug.Print start_date
Debug.Print end_date
Exit Sub
Else
End If
rs.MoveNext
Loop
Exit Sub
End Sub
Thanks in advance.
Regards,
Ben