ShannonSkipper
Technical User
SkipVought was kind enough to write the following code for me:
(I am trying to get a query to tell me who is up to recieve a subscription this month...)
So, I pasted the code in a module named SendSubscription. Then I build a query that looks like the following in SQL view:
When I try to run the query I get the following error: "undefined function 'SendSubscription' in expression".
What am I doing wrong? I'm afraid I am very new at this... Thanks in advance for the help!!!
Code:
Function SendSubscription(StartMonth As Integer, Frequency As String) As Boolean
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 = Month(Date) Mod f Then
SendSubscription = True
Else
SendSubscription = False
End If
End Function
So, I pasted the code in a module named SendSubscription. Then I build a query that looks like the following in SQL view:
Code:
SELECT Demographics.DemographicsID, Demographics.FirstName, Demographics.LastName, Action.Date, Action.Frequency, Month([Date]) AS StartMonth
FROM Demographics INNER JOIN [Action] ON Demographics.DemographicsID = Action.[Foreign Key]
WHERE SendSubscription([StartMonth],[Frequency])=True;
What am I doing wrong? I'm afraid I am very new at this... Thanks in advance for the help!!!