Originally Posted by
John_G
Hi -
Remember that date formatting is for display purposes (screen or print), or input mask only. These settings do not affect how MS Access stores dates.
Microsoft likes to assume that the whole world uses the illogical date format mm/dd/yyyy, and that's what you need to use in VBA. In your case, though, it is a simple fix. Change the statement in your original post from this:
DoCmd.OpenForm "frmBookingEditAdminStep", , , "BookingDate between#" & Format(Me.txtFrom, "dd\/mm\/yyyy") & "# and #" & Format(Me.txtUntil, "dd\/mm\/yyyy") & "# and StatusID<>5"
to this:
DoCmd.OpenForm "frmBookingEditAdminStep", , , "BookingDate between#" & Format(Me.txtFrom, "mm/dd/yyyy") & "# and #" & Format(Me.txtUntil, "mm/dd/yyyy") & "# and StatusID<>5"
All I did was change the format of the date in the text string - no changes in the data are needed.
HTH
John