reference: Basic VBA question
thread705-352369
I've got a similar problem...to that posed in Thread 705-352369. Being a novice at this, I am asking some very basic questions here.
Am basing my record-set on a Query. This isn't working out because the query doesn't know which email I am on. I am creating the email on a form.
So my Subject, and the body should not be rst!Subject, or rst!Body, rst!EmailID, but some reference to the current record in the form I am using.
The clickevent on the form will send the email to all those in the query, but with only the current record showing subject and body.
How do I refence that?
Many thanks!
Robert
thread705-352369
I've got a similar problem...to that posed in Thread 705-352369. Being a novice at this, I am asking some very basic questions here.
Am basing my record-set on a Query. This isn't working out because the query doesn't know which email I am on. I am creating the email on a form.
So my Subject, and the body should not be rst!Subject, or rst!Body, rst!EmailID, but some reference to the current record in the form I am using.
The clickevent on the form will send the email to all those in the query, but with only the current record showing subject and body.
How do I refence that?
Many thanks!
Robert
Code:
Dim rst As DAO.Recordset
Dim dbs As DAO.Database
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("QrySendEmail")
If (Not rst.EOF) And (Not rst.BOF) Then
rst.MoveFirst
While Not rst.EOF
strSubject = rst!Subject
strMsg = "Dear " & rst!FIRSTNAME & " " & rst!LASTNAME & ":" & vbCrLf & vbCrLf
strMsg = strMsg & rst!Body & " " & rst!Note & vbCrLf & vbCrLf
strMsg = strMsg & "Regards, Robert" & vbCrLf & vbCrLf & "Email ID: 00" & rst!EmailID