Enter Parameter Value

louisa

Registered User.
Local time
Today, 20:00
Joined
Jan 27, 2010
Messages
262
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 am probably wrong but i think i am getting the Enter Parameter Value because there is nothing in the EndDate field. Not all records will have this information entered but the end result i am looking for is once "CLIStartDate" has had a date entered and "Duration" has an amount of months entered then "EndDate" will show the expiring date. Then if a record has less than 45 days until expiring then the form "Test" is to load displaying the company name.
 
Does anyone have any ideas?
 

Users who are viewing this thread

Back
Top Bottom