L
Louverril
I am trying to find the first record in a table with an expiry date greater
than the current system date, but I can't get the correct findfirst syntax.
I'm using Uk date format for everything - system date is set to dd/mm/yyy.
See problem line below:
Dim db As Database
Set db = CurrentDb
Dim rec As DAO.Recordset
Set rec = db.OpenRecordset("Select * from tblCheck where Activated = " &
True)
With rec
.FindFirst "Expiry_Date >= " & Now '''PROBLEM LINE
If .NoMatch Then
fCheckExpiryDate = False
ElseIf !Expiry_Date >= Now Then
fCheckExpiryDate = True
End If
End With
What is the correct syntax for the findfirst (and does the set rec statement
look correct?)
Have also tried:
Dim TodaysDate As Date
TodaysDate = Now
.FindFirst "Expiry_Date >= #" & Format(TodaysDate, "mm\/dd\/yyyy") & "#"
And
..FindFirst ("Expiry_Date >= #" & Format(Now, "yyyy-mm-dd hh:nn:ss") & "#")
And
..FindFirst "Birthday >= #" & Now & "#"
Thanks Lou
than the current system date, but I can't get the correct findfirst syntax.
I'm using Uk date format for everything - system date is set to dd/mm/yyy.
See problem line below:
Dim db As Database
Set db = CurrentDb
Dim rec As DAO.Recordset
Set rec = db.OpenRecordset("Select * from tblCheck where Activated = " &
True)
With rec
.FindFirst "Expiry_Date >= " & Now '''PROBLEM LINE
If .NoMatch Then
fCheckExpiryDate = False
ElseIf !Expiry_Date >= Now Then
fCheckExpiryDate = True
End If
End With
What is the correct syntax for the findfirst (and does the set rec statement
look correct?)
Have also tried:
Dim TodaysDate As Date
TodaysDate = Now
.FindFirst "Expiry_Date >= #" & Format(TodaysDate, "mm\/dd\/yyyy") & "#"
And
..FindFirst ("Expiry_Date >= #" & Format(Now, "yyyy-mm-dd hh:nn:ss") & "#")
And
..FindFirst "Birthday >= #" & Now & "#"
Thanks Lou