M
Mollybot
I have developed a database which holds training records.
I would like to have the user notified when the switchboard loads informing
them of the training records which are out of date now and are due in six
months time. If selected a report preview is loaded.
The code below has been added to the Form_load event.
The error message I get is "Runtime error 3075" from the Dcount function in
intStoreB (the six month check)
Syntax error (missing operator) in query expression [Renewal] <= 23 Feb 2007
11:50:04
I am also curious as to how I can retain focus on the Report preview - (less
important. I have tried to resolve this myself for about three hours now and
can't seem to find the right string construction any help you can give would
be gratefully received. Thank you in advance.
Private Sub Form_Load()
'On Load of the switchboard check Courses table for any Courses overdue or
due for Renewal
Dim intStoreA As Integer
Dim intStoreB As Integer
Dim strMonthSix As String
strMonthSix = DateAdd("m", 6, Now())
'Count of Overdue Courses that are past the Expected Renewal Date
intStoreA = DCount("[Renewal]", "Courses", "[Renewal] <=Now()")
'Count of Courses that are due in the next six months
intStoreB = DCount("[Renewal]", "Courses", "[Renewal] <= " & strMonthSix)
'If count of Overdue Courses is zero display switchboard
'Else display message box detailing amount of renewals
'and give the user the option as to whether to view these or not.
If intStoreA = 0 And intStoreB = 0 Then
Exit Sub
Else
If MsgBox("There are " & intStoreA & " courses overdue and " &
intStoreB & _
vbCrLf & "due in the next six months" & _
vbCrLf & "Would you like to see these now?", _
vbYesNo, "You Have courses overdue...") = vbYes Then
DoCmd.Minimize
DoCmd.OpenReport "Courses due for renewal", acPreview
Else
Exit Sub
End If
End If
End Sub
I would like to have the user notified when the switchboard loads informing
them of the training records which are out of date now and are due in six
months time. If selected a report preview is loaded.
The code below has been added to the Form_load event.
The error message I get is "Runtime error 3075" from the Dcount function in
intStoreB (the six month check)
Syntax error (missing operator) in query expression [Renewal] <= 23 Feb 2007
11:50:04
I am also curious as to how I can retain focus on the Report preview - (less
important. I have tried to resolve this myself for about three hours now and
can't seem to find the right string construction any help you can give would
be gratefully received. Thank you in advance.
Private Sub Form_Load()
'On Load of the switchboard check Courses table for any Courses overdue or
due for Renewal
Dim intStoreA As Integer
Dim intStoreB As Integer
Dim strMonthSix As String
strMonthSix = DateAdd("m", 6, Now())
'Count of Overdue Courses that are past the Expected Renewal Date
intStoreA = DCount("[Renewal]", "Courses", "[Renewal] <=Now()")
'Count of Courses that are due in the next six months
intStoreB = DCount("[Renewal]", "Courses", "[Renewal] <= " & strMonthSix)
'If count of Overdue Courses is zero display switchboard
'Else display message box detailing amount of renewals
'and give the user the option as to whether to view these or not.
If intStoreA = 0 And intStoreB = 0 Then
Exit Sub
Else
If MsgBox("There are " & intStoreA & " courses overdue and " &
intStoreB & _
vbCrLf & "due in the next six months" & _
vbCrLf & "Would you like to see these now?", _
vbYesNo, "You Have courses overdue...") = vbYes Then
DoCmd.Minimize
DoCmd.OpenReport "Courses due for renewal", acPreview
Else
Exit Sub
End If
End If
End Sub