Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

d

Status
Not open for further replies.

ShannonSkipper

Technical User
Sep 9, 2004
23
US
I have a query that calls up the following module:
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
The query reads as follows in SQL view:
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));
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
 
Sharon try this in your code, where checkmonth$ is the result of your combobox
Code:
'" & checkmonth$ & "'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top