• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Excel date changed VBA

Imyuddin

New Member
Hi, am a beginner to excel VBA and having an issue with a form I created in VBA to calculate annual leave for my organisation

When I enter the dates in the form for start date, from date and to date, it changes the format from dd/mm/yyyy to mm/dd/yyyy in the database where the data is being recorded. I understand it has something to do with me using a string for the data input box instead of a date string. But my knowledge and expertise in VBA is limited, I used a tutorial to create this form and then customised it to my organisation, everything works apart from this. Any help will be much appreciated as it is a tool we need at work to make life much easier. I have attached the file.

Thank you
 

Attachments

Belleke

Well-Known Member
Try
Code:
 .Cells(jRow, 7) = CDate(frfForm.txtstartdate.Value)
 .Cells(jRow, 9) = CDate(frfForm.txtholidayfrom.Value)
 .Cells(jRow, 10) = CDate(frfForm.txtholidayto.Value)
 

Imyuddin

New Member
However, sorry to be a pain. It does not add the record to the database it over rides the previous data? So only one row is updated
 
Top