Check for Future Dates

brucey54

Registered User.
Local time
Today, 05:04
Joined
Jun 18, 2012
Messages
155
Hi folks, I have created a function to check for future dates, but how do I make it generic.

I am assigning the function 'Before Update' on the textbox property.

I do not want to type each textbox name, any help much appreciated.

code below

Public Function CheckDate()

Dim myDate

myDate = textbox.Value

If myDate > Date Then
MsgBox "You've entered a future date", vbOKOnly, "Future Date"
Cancel = True
End If

End Function
 
Usage
Cancel =checkDate(txtBox3)

Code:
Public Function CheckDate(myDate) as Boolean
   If myDate > date() then        
 MsgBox
 CheckDate =true
End if
 
End function
 

Users who are viewing this thread

Back
Top Bottom