David has attended:
Access VBA course
Date format activex calendar
using the activex calendar the dates 1-12 of the month go to the query as mm/dd/yyyy format but 13+ go as dd/mm/yyyy format. Is there a way to force it to be consistent? Thanks
RE: Date format activex calendar
Hi David
Thank you for your question
You can do this using a combination of datepart() functions, string cocatenation, and cdate() functions to reformat the date.
I will write a small procedure to solve this and will post it here later today or tommorrow
Regards
Stephen
RE: Date format activex calendar
Hi David
Sorry for the delay in getting back to you. Here is the required code as promised.
This is a function. You should write a procedure that runs when you click the forms command button, that passes the calender's value to the function as the US date argument
If you have any questions please do not hesitate to get back to me
Public Function DateConverter(USDate As String) As Date
Dim strMonth As String
Dim strDay As String
Dim strYear As String
Dim strDate As String
strDay = DatePart("d", USDate)
strMonth = DatePart("m", USDate)
strYear = DatePart("yyyy", USDate)
strDate = strDay & "/" & strMonth & "/" & strYear
DateConverter = CDate(strDate)
End Function