patrickmcdiver
Registered User.
- Local time
- Today, 01:59
- Joined
- Jan 7, 2010
- Messages
- 39
I have the following code in my db to create a reminder about maintenance that may be do:
Private Sub Form_Load()
'On Load of Main Form check Jobs for any maintenance due
Dim intStore As Integer
'Count of Maintenance jobs that are due
intStore = DCount("Vehicle", "Expenses", "[Service Due]<[Current Mileage]")
'If count of uncomplete jobs is zero display switchboard
'Else display message box detailing amount of jobs
'and give the user the option as to whether to view these or not.
If intStore = 0 Then
Exit Sub
Else
If MsgBox("There are " & intStore & " maintenance items due" & _
vbCrLf & vbCrLf & "Would you like to see these now?", _
vbYesNo, "You Have Maintenance Due!...") = vbYes Then
DoCmd.Minimize
DoCmd.OpenReport "Copy of Vehicle Details", acNormal, preview
Else
Exit Sub
End If
End If
End Sub
The problem is that when I click on yes in the msgbox (to view maintenance due) it prints the report "Copy of Vehicle Details" instead of just opening it. Where did I go wrong.
Thanks in advance for your help. You guys have really taught me a lot about code. I have very limited experience with Access
Private Sub Form_Load()
'On Load of Main Form check Jobs for any maintenance due
Dim intStore As Integer
'Count of Maintenance jobs that are due
intStore = DCount("Vehicle", "Expenses", "[Service Due]<[Current Mileage]")
'If count of uncomplete jobs is zero display switchboard
'Else display message box detailing amount of jobs
'and give the user the option as to whether to view these or not.
If intStore = 0 Then
Exit Sub
Else
If MsgBox("There are " & intStore & " maintenance items due" & _
vbCrLf & vbCrLf & "Would you like to see these now?", _
vbYesNo, "You Have Maintenance Due!...") = vbYes Then
DoCmd.Minimize
DoCmd.OpenReport "Copy of Vehicle Details", acNormal, preview
Else
Exit Sub
End If
End If
End Sub
The problem is that when I click on yes in the msgbox (to view maintenance due) it prints the report "Copy of Vehicle Details" instead of just opening it. Where did I go wrong.
Thanks in advance for your help. You guys have really taught me a lot about code. I have very limited experience with Access