theinviter
Registered User.
- Local time
- Yesterday, 18:03
- Joined
- Aug 14, 2014
- Messages
- 244
Hi guys;
i need help, i have a form which have a button to print a paper and when the user click on the button as there are two field one with date and another filed with time, need to verify if the date and time less than now plus 5 hour then will not able to print the form but if above then will be able to print.
Field A = Exp_date
Field B = Time
please find the code i tried below.
i need help, i have a form which have a button to print a paper and when the user click on the button as there are two field one with date and another filed with time, need to verify if the date and time less than now plus 5 hour then will not able to print the form but if above then will be able to print.
Field A = Exp_date
Field B = Time
please find the code i tried below.
Code:
Private Sub Command47_Click()
On Error GoTo errhandler:
N = 1 / 0 ' cause an error
If exp_date < (Now() + 0.209) And time < (Now() + 0.209) Then
' Display a message
MsgBox "Date entered not correct", vbExclamation
' Cancel the update
Cancel = True ' -1 or 37 would work just as well
Else
DoCmd.RunMacro "LABEL MACRO"
End If
Exit Sub
errhandler:
' error handling code
Resume Next
End Sub
Last edited by a moderator: