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 » Access VBA Dates
Access VBA Dates
Resolved · Low Priority · Version 2003
Claire has attended:
Access Introduction course
Access Intermediate course
Access Advanced course
Access VBA course
Access Intermediate course
Access VBA Dates
When running a date limited analysis of our data we found that is we chose a date such as 7th Feb 1997 to 7th Feb 1997 (ie one days orders) we got results for 2nd July 1997 (ie American date format), however if you used a date outside the 12 months ie Feb 13th 1997 it would use the English dates and return the right data. How do we get round this.
PS Can I get a certificate for this course
RE: Access VBA Dates
Hi Claire
Thanks for your question
This can be done by using a combination of datepart() functions, string cocatenation, and cdate functions to reorganise the date.
I will write a small procedure to solve this and will post it here later today or tommorrow
Regards
Stephen
RE: Access VBA Dates
Hi Claire
Sorry for the delay in responding.
I have created the following function which converts the date into UK format. It should be called from the on click procedure where the variable returned by the calendar control should be set as it's argument.
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
Regards
Stephen
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. |
Access tip:Design View in Relationship windowYour in the Relationship window and changes are required to be made to a Table's design. |