Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

access vba dates

ResolvedVersion 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

RE: Access VBA Dates

Many thanks

I haven't had my certificate yet, can you advise?

 

Training courses

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
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.

Access tip:

Switchboard Startup

An option when you open your Access database that contains all of you tables, forms and queries is only the switchboard is displayed.

To achieve this, select Tools click on Startup. On the right hand side of the Startup screen you are able to select which form you want to open when you open you Access Database. Once you have selected this, there is a check box just below that says "Display Database Window", you need to uncheck this option. Then click ok.

Then when you close you Access database and re open it, the database should open with just the switchboard being shown


View all Access hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.09 secs.