Hi
I have been creating a small Access database for my partners business and everything was going well until I tried to search services between two dates, everything works fine when I run the query but when I try and run from a form the first textbox (txtStartDate)will only accept the date in US format while the other textbox (txtEndDate) will only work in UK format (which is what I want). I have tried changing all the format settings, Cdate, I even copied the txtEndDate to see if it made any difference.
txtStartDate will only work correctly when I change the date to US eg. 01/04/2020 needs to be 04/01/2020
txtEndDate works fine with 30/04/2020, however when I try both dates in US format the txtEndDate changes back to UK format.
I would be very grateful for any help you can give me.
The only code relating to these textboxes is as follows:
Code:Sub Search() Me.Refresh Dim strCriteria, task As String If IsNull(Me.txtStartDate) Or IsNull(Me.txtEndDate) Then MsgBox "please enter a Date Range", vbInformation, "Date Range Required" Me.txtStartDate.SetFocus Else strCriteria = "([ServiceDate] >= #" & Me.txtStartDate & "# AND [ServiceDate] <= #" & Me.txtEndDate & "#)" task = "SELECT * from qryServicesSearch WHERE (" & strCriteria & ") ORDER by [ServiceDate]" DoCmd.ApplyFilter task End If End Sub