D
Don
So close yet so far......
I have a make table query that creates s table
called "temptable"
I want to, through code, cycle through the records in that
table and create one large string from one of the field.
This is part of my code (I am still a newbie to VBA). I
set a type mismatch error in this line of code:
Set rstClass = db.OpenRecordset("temptable")
It looks ok to me, unless I can't open tables using the
OpenRecordset command. Can anyone help me?
I feel I am very close. Thanks in advance,
Don
Dim db As Database
Dim rstClass As Recordset
Dim strTo As String
'Declare the needed variables
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim ccRecips As String
Dim strClassName As String, strClassDate As String,
strClassTime As String
Set db = CurrentDb()
Set rstClass = db.OpenRecordset("temptable")
rstClass.MoveFirst
Do Until rstClass.EOF
strTo = strTo & rstClass(StudentID).Value & ";"
rstClass.MoveNext
Loop
MORE CODE...........
'Add the To recipents to the message
Set objOutlookRecip = .Recipients.Add(strTo)
objOutlookRecip.Type = olTo
I have a make table query that creates s table
called "temptable"
I want to, through code, cycle through the records in that
table and create one large string from one of the field.
This is part of my code (I am still a newbie to VBA). I
set a type mismatch error in this line of code:
Set rstClass = db.OpenRecordset("temptable")
It looks ok to me, unless I can't open tables using the
OpenRecordset command. Can anyone help me?
I feel I am very close. Thanks in advance,
Don
Dim db As Database
Dim rstClass As Recordset
Dim strTo As String
'Declare the needed variables
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim ccRecips As String
Dim strClassName As String, strClassDate As String,
strClassTime As String
Set db = CurrentDb()
Set rstClass = db.OpenRecordset("temptable")
rstClass.MoveFirst
Do Until rstClass.EOF
strTo = strTo & rstClass(StudentID).Value & ";"
rstClass.MoveNext
Loop
MORE CODE...........
'Add the To recipents to the message
Set objOutlookRecip = .Recipients.Add(strTo)
objOutlookRecip.Type = olTo