I am trying to use the code from Allen Browne where Dates are handled whether or not in dd/mm/yy or mm/dd/yy
to open a report and list entries where a date field is less than 2 months away
I have
DoCmd.OpenReport "rptCerts", acViewReport, , "[CertDateExp] < #" & DateAdd("m", 2, Date) & "#"
which is fine but not in this part of the world as today being 2/3 becomes 2/5 in two months which 5th Feb elsewhere
code below is me just mucking about to no useful effect
Private Sub btnCertsExp_Click()
Dim strWhere As String
Dim strDateField As String
Const strcJetDate = "\#mm\/dd\/yyyy\#"
'Set Date for all before two months from now
strDateField = CertDateExp
strWhere = "(" & strDateField & " >= " & Format("#" & DateAdd("m", 2, Date) & "#", strcJetDate) & ")"
DoCmd.OpenReport "rptCerts", acViewReport, , strWhere
End Sub
Thanks