Hi All,
I thought i has sussed this myself but unfortunately not and again need some advise.
I have a field called EndDate which has the following control source - =DateAdd("m",[Duration],[CLIStartDate])
I have a form called "Network" which has the following OnLoad event - Private Sub Command0_Click()
MsgBox DCount("[ContactID]", "[Network]", "[EndDate]" < Date - 45)
End Sub
Private Sub Form_Load()
Dim stDocName As String
stDocName = "Test"
If DCount("[ContactID]", "[Network]", "[EndDate]" < Date - 45) Then
MsgBox "There are " & DCount("[ContactID]", "[Network]", "[EndDate]" < Date - 45) & " Records with F.O.C services that are 45 days from expiring"
DoCmd.OpenForm stDocName, , , "[EndDate] < Date()-45"
End If
End Sub
Private Sub Command4_Click()
On Error GoTo Err_Command4_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Test"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Command4_Click:
Exit Sub
Err_Command4_Click:
MsgBox Err.Description
Resume Exit_Command4_Click
End Sub
Private Sub Command5_Click()
On Error GoTo Err_Command5_Click
Dim stDocName As String
stDocName = "Test"
DoCmd.OpenForm stDocName, , , "[EndDate] < Date()-45"
Exit_Command5_Click:
Exit Sub
Err_Command5_Click:
MsgBox Err.Description
Resume Exit_Command5_Click
End Sub
Now everytime i open the form it says enter parameter value EndDate, not every record will have an enddate which is autopopulated. Can anybody advise how i am going wrong?
I thought i has sussed this myself but unfortunately not and again need some advise.
I have a field called EndDate which has the following control source - =DateAdd("m",[Duration],[CLIStartDate])
I have a form called "Network" which has the following OnLoad event - Private Sub Command0_Click()
MsgBox DCount("[ContactID]", "[Network]", "[EndDate]" < Date - 45)
End Sub
Private Sub Form_Load()
Dim stDocName As String
stDocName = "Test"
If DCount("[ContactID]", "[Network]", "[EndDate]" < Date - 45) Then
MsgBox "There are " & DCount("[ContactID]", "[Network]", "[EndDate]" < Date - 45) & " Records with F.O.C services that are 45 days from expiring"
DoCmd.OpenForm stDocName, , , "[EndDate] < Date()-45"
End If
End Sub
Private Sub Command4_Click()
On Error GoTo Err_Command4_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Test"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Command4_Click:
Exit Sub
Err_Command4_Click:
MsgBox Err.Description
Resume Exit_Command4_Click
End Sub
Private Sub Command5_Click()
On Error GoTo Err_Command5_Click
Dim stDocName As String
stDocName = "Test"
DoCmd.OpenForm stDocName, , , "[EndDate] < Date()-45"
Exit_Command5_Click:
Exit Sub
Err_Command5_Click:
MsgBox Err.Description
Resume Exit_Command5_Click
End Sub
Now everytime i open the form it says enter parameter value EndDate, not every record will have an enddate which is autopopulated. Can anybody advise how i am going wrong?