Macro to verify date format - Help!

sonaljain123

Registered User.
Local time
Today, 04:20
Joined
Jul 6, 2011
Messages
68
Hi,

Following is the macro I am currently using to import data from excel into a MS Access Database. What I want to add is a feature where in if a user enters the date in the wrong format, a message box appears saying "Date format Incoorect".

Private Sub importFile()
Dim inDate As String
Dim iDate As String
Dim iFDate As String
inDate = InputBox("Please enter the date for which you would like to add the data in mm/dd/yyyy format")
iFDate = Format(inDate, "mm/dd/yyyy")
iDate = Format(inDate, "mmddyy")
ImportProtected iFDate, "K:\CLE03\M\daily comparison_ " & iDate & ".xls", ""
End Sub

ImportProtected is another macro that it is running.

Any help wud be appreciated!

Thank you!!
 

Users who are viewing this thread

Back
Top Bottom