ShannonSkipper
Technical User
I have a query that calls up the following module:
The query reads as follows in SQL view:
My question is how I define the CheckMonth variable in the query. Right now it is opening up a parameter box and asking my for the value but I want to be able to choose the month (as a string) from a combo box on a form and have the integer of that month sent as the CheckMonth variable. I've tried making an expression that refers to the combo box in the form but the expression name is not accepted as a variable in the module.
Any help is greatly appreciated,
Shannon
Code:
Public Function SendSubscription(StartMonth As Integer, Frequency As String, CheckMonth As Integer) As Boolean
Dim F As Integer
Select Case Frequency
Case "Monthly"
F = 1
Case "Quarterly"
F = 3
Case "Semi-Annually"
F = 6
Case "Annually"
F = 12
End Select
If StartMonth Mod F = CheckMonth Mod F Then
SendSubscription = True
Else
SendSubscription = False
End If
End Function
Code:
SELECT Demographics.FirstName, Demographics.LastName, Action.sDate, Action.Frequency, Action.[Action Type], Action.Issue, Action.Monitoring, Action.Notes, Demographics.DemographicsID, Action.tDate, Action.Board, SendSubscription([StartMonth],[Frequency],[CheckMonth]) AS Expr1
FROM Demographics INNER JOIN [Action] ON Demographics.DemographicsID = Action.[Foreign Key]
WHERE (((Action.tDate) Is Null) AND ((Action.Board)=[Forms]![frmCriteria]![Board]) AND ((SendSubscription([StartMonth],[Frequency],[CheckMonth]))=True));
Any help is greatly appreciated,
Shannon