My Assistant
![]() ![]() |
|
|
May 6 2012, 07:36 PM
Post
#1
|
|
|
UtterAccess Enthusiast Posts: 56 |
Hi all~
Having a little difficulty on this one and would appreciate any and all help. In a nutshell, I've created an email form that opens from a communications record form that places the email address of the person selected (using openArgs- no problem so far) into the control txtTo. However, if a user decides to send a blanket email to all members of the particular group after opening the email form, I've provided a checkbox which if "checked"makes visible a combo-box that displays all of the groups (in this case, instructor classes). In the change event of that combo-box, I want to fill the txtTo field with the email addresses of everyone in the class selected. I've been playing and manipulating the code for a while but have been running into errors that I haven't been able to overcome: CODE Private Sub cboClass_Change() Dim db As DAO.Database Dim qdf As Object Dim myQry As String Dim cid As Integer Dim strEmail As String Set db = CurrentDb cid = txtClass.Value myQry = "PARAMETERS [RID] Integer; SELECT tblRosters.RosterClass, tblStudents.StudentEmail FROM tblStudents INNER JOIN tblRosters ON tblStudents.StudentID = tblRosters.RosterStudent WHERE (((tblRosters.RosterClass)= [RID]));" 'Set rs = db.OpenRecordset("myQry") Set qdf = db.CreateQueryDef("", myQry) qdf.Parameters![RID] = Me.txtClass.Value With qdf Do While Not .EOF strEmail = strEmail & .Fields("StudentEmail") & ";" .MoveNext Loop .Close End With strEmail = Left(strEmail, Len(strEmail) - 1) 'txtTo = strEmail End Sub Issues have arisen at the "With qdf" statement- I'm getting a "run-time error 438; object doesn't support this property or method." At this point all I need is to be able to pull the email addresses using the query and insert the semicolons between them. Thanks for your help! |
|
|
|
May 6 2012, 07:44 PM
Post
#2
|
|
|
UtterAccess Enthusiast Posts: 56 |
Just for clarification if the code didn't do so;
based on a users selection within the cboClass combo box, I have a hidden textbox on the form that contains the ID that will serve as the parameter for the query (txtClass). |
|
|
|
May 6 2012, 07:47 PM
Post
#3
|
|
|
UtterAccess Enthusiast Posts: 56 |
And I've commented out the "txtTo =" code because at this point there have been other issues
|
|
|
|
May 7 2012, 12:23 PM
Post
#4
|
|
|
UtterAccess Enthusiast Posts: 56 |
FYI to any following; I re-posted this into Access queries and its now solved.
|
|
|
|
![]() ![]() |
|
Go to Top · Lo-Fi Version | Time is now: 20th May 2013 - 01:30 PM |