98.7% Of all customers recommend us, we're so confident about our results we publish all reviews and stats
View Live Stats View ReviewsForum home » Delegate support and help forum » Microsoft Access VBA Training and help » Date format activex calendar
Date format activex calendar
Resolved · Medium Priority · Version 2003
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
Training information:
Welcome. Please choose your application (eg. Excel) and then post your question. Our Microsoft Qualified trainers will then respond within 24 hours (working days). Frequently Asked Questions
Any suggestions, questions or comments? Please post in the Improve the forum thread. |