I have a database (Access 2003) of vehicles and i need to query when an MOT is due. I Wanted it to open a form and show the MOT date 10 days before the MOT is due. This is what i have so far. All this does is open the form and display th msgbox even when there are mot's due.
I would be very grateful of any help.
Thanks
Andy
Private Sub Command0_Click()
Dim vehicle As Database
Set vehicle = CurrentDb
Dim MOT As Date
MOT = Date + 10
DoCmd.OpenForm "FMotDueDate"
If Forms!FMotDueDate!MOTDate = MOT Then
Forms!FMotDueDate!MOTDate.SetFocus
Else: MsgBox "NO MOT'S ARE DUE", vbOKOnly
End If
End Sub
I would be very grateful of any help.
Thanks
Andy
Private Sub Command0_Click()
Dim vehicle As Database
Set vehicle = CurrentDb
Dim MOT As Date
MOT = Date + 10
DoCmd.OpenForm "FMotDueDate"
If Forms!FMotDueDate!MOTDate = MOT Then
Forms!FMotDueDate!MOTDate.SetFocus
Else: MsgBox "NO MOT'S ARE DUE", vbOKOnly
End If
End Sub