microsoft access vba courses - recognising dates
Microsoft Office TrainingThe UK's Number 1 for Microsoft Office Training Sitemap add this page to your favourites/bookmarksBookmark page
 
view a printable version of this pagePrintable version
Plus One Google
Customer: Sign in
Delegate: Sign in
Trainer: Log in

Forum home » Delegate support and help forum » Microsoft VBA Training and help » microsoft access vba courses - Recognising Dates

microsoft access vba courses - Recognising Dates

resolvedResolved · Low Priority · Version Standard

replyReplyTue 22 Jan 2008, 14:49Delegate James said...

Recognising Dates

Hi Carlos,

I am currently writing a macro that, in one section of it, needs to search through a list of dates (row by row assigning each date to a variable and comparing using SelectCase). Unfortunately the list is an export from a piece of software that creates date cells in the format
" 12/31/2007"

The problem occurs when the cell shows
" 01/02/2008" to " 01/12/2008"
excel seems to treat this as dd/mm/yyyy and then back to mm/dd/yyyy when the middle value is more than 12.

I then use the line:
DateValue = ActiveCell.Value
to assign the data in this cell to the variable "DateValue".

Is there anything I can add to this line to assign the variable in a uniform manner?

Regardss,

James

For upcoming training course dates see: Pricing & availability

replyReplyTue 22 Jan 2008, 15:18Delegate James said...

RE: Recognising Dates

I have just found one solution for this - changing my computers regional setting to US!
Is this the only fix or is there an easier one?

replyReplyWed 6 Feb 2008, 17:05Trainer Carlos said...

RE: Recognising Dates

Hi James

Received the e-mail but there was just an image of the regional options dialog box attached.

Could you send the workbook?

I'm busy training the next few days but as soon as I get some time I'll look at it.

Carlos

replyReplyWed 6 Feb 2008, 10:13Trainer Carlos said...

RE: Recognising Dates

James

First Don't use DateValue as a variable name. This is a Date Function in Excel

I created 2 variables :

1. MyDate - This holds the date being compared to
2. ImportDate - This will hold each of the imported dates to compare

Now compare the two dates eg:

MyRow = 1

ImportDate = Cells(MyRow,1).Value

If MyDate = ImportDate then

<Do code>

MyRow = MyRow + 1

End If

This can loop through all the dates

By doing this the computer saves the imported date as UK.

Hope this helps. If not please send me the Weorkbook with your code and I'll see what I can do

Regards

Carlos

replyReplyWed 6 Feb 2008, 12:38Delegate James said...

RE: Recognising Dates

Carlos,

I have a similar code setup for the loop (just with a couple more variables - firstdate, seconddate etc) with a select case instead of an IF.

I have tried changing DateValue to ImportDate but this doesn't work.
Can you send me your email address so that I can attach the workbook? I can't seem to attach files to this reply...

Regards,

James

replyReplyWed 6 Feb 2008, 14:52Trainer Carlos said...

RE: Recognising Dates

Hi James

Send the workbook to

info at microsofttraining.net

Attention Carlos

and my collegues will forward it to me

Regards

Carlos

 

 

Vba tip:

Stop Screen Flickering When Running Code

Running VBA code may cause the screen to flicker as the monitor is the slowest part of the program and cannot keep up with the very fast changes taking place.

To switch off the screen until the program is run enter the following code line:

Application.ScreenUpdating = False

The screen comes on automatically on completion of the program.

View all VBA hints and tips

forum postI need to change the year and move monthly sales figures along in our monthly Budget Reports.
Is there a calculation/formula that can be used?

» Forum post: Access


Rate this page:
2.2/5 (213 votes cast)
Accredited Training Provider: Institute of IT Training Institute of Leadership and Management - Certified Courses
Microsoft Certified Partner
Security Seal verified by visa, mastercard securecard

Mini sitemap. These are the main areas of our web site. Full sitemap.

Management training

Professional Skills courses
Project Management Course London
Project Management Courses London
Project Management Training London
Project Management Training
Project Seminar
Project Seminars
Time Management Course London
Time Management London
Time Management Courses London
Time Management Training London
Introduction to Finance course
Assertiveness Skills course
Effective Communications Skills training
Presentation Skills London

Training Formats

Public scheduled courses
On-site training
Closed company courses

Consultancy
Application Development

Blogs

Excel Training
MS Project Training
Microsoft Training Blog

Version differences

Office 2010 vs 2007
MS Project version differences

Training Information

London Computer Training
Computer Training London
Docklands Training Courses
Docklands Training London

Training venues London
Client list
FAQ
Pricing and availability
Course details / Syllabus

Training Articles
Training Information

Microsoft training

Microsoft Office training
& IT Applications

Microsoft Project training
Microsoft Outlook training
Microsoft Powerpoint training
Microsoft Word training
MS Project courses
MS Project training
Outlook courses
PowerPoint courses
PowerPoint training
VBA courses
Word courses
Microsoft.training
(more...)

Excel Training

Excel courses
Excel Training Courses Medway
Autonumber in Excel
Microsoft Excel training
Basic Excel Courses
Basic Excel Course
Basic Excel Training

Interested in MS Access training?

Access courses
Microsoft Access training
Microsoft access courses
Microsoft training access course
Microsoft+access+training
Access courses in london

Training provider

Training providers
IT training companies
IT training providers
Management Training providers
Management Training provider

Event history, feedback results
Events in 2012 · 2011 · 2010 · More

See also

Crystal Reports training