R
Robert T
Hello:
I apologize because I asked the same question last week in another forum,
but for the life of me, I can’t find the thread. We want to register new
students for our training courses here at work and then click a button a form
that sends a confirmation email via Outlook 2003. Arvin was kind enough to
send me a script but it isn’t working, so I’m hoping someone can help.
The first two dim statements cause the following error message:
Compile Error:
“User Defined Type not definedâ€
If I comment out the first two DIM statements, the script also stops at the
Me.Student_FirstName field, saying there is no such record. I carefully
checked the form and there is a Student_FirstName field with that very name.
Here’s the script provided by Arvin.
Private Sub Command0_Click()
'Arvin Meyer 03/12/1999
'Updated 7/21/2001
On Error GoTo Error_Handler
Dim objOutlook As Outlook.Application
Dim objEmail As Outlook.MailItem
Dim strBody As String
strBody = Me.StudentID & ", " & _
Me.Student_LastName & ", " & _
Me.Student_FirstName & vbCrLf & vbCrLf & _
Me.CourseID & " and " & _
Me.CourseName & vbCrLf & vbCrLf & _
Me.Class_Date & ", " & _
Me.Class_Time & ", and " & _
Me.Class_Location & vbCrLf & vbCrLf & _
"You are now registered to attend the course shown above."
Set objOutlook = CreateObject("Outlook.application")
Set objEmail = objOutlook.CreateItem(olMailItem)
With objEmail
.To = Me.Student_Email
.Subject = "Registration Information"
.body = strBody
I apologize because I asked the same question last week in another forum,
but for the life of me, I can’t find the thread. We want to register new
students for our training courses here at work and then click a button a form
that sends a confirmation email via Outlook 2003. Arvin was kind enough to
send me a script but it isn’t working, so I’m hoping someone can help.
The first two dim statements cause the following error message:
Compile Error:
“User Defined Type not definedâ€
If I comment out the first two DIM statements, the script also stops at the
Me.Student_FirstName field, saying there is no such record. I carefully
checked the form and there is a Student_FirstName field with that very name.
Here’s the script provided by Arvin.
Private Sub Command0_Click()
'Arvin Meyer 03/12/1999
'Updated 7/21/2001
On Error GoTo Error_Handler
Dim objOutlook As Outlook.Application
Dim objEmail As Outlook.MailItem
Dim strBody As String
strBody = Me.StudentID & ", " & _
Me.Student_LastName & ", " & _
Me.Student_FirstName & vbCrLf & vbCrLf & _
Me.CourseID & " and " & _
Me.CourseName & vbCrLf & vbCrLf & _
Me.Class_Date & ", " & _
Me.Class_Time & ", and " & _
Me.Class_Location & vbCrLf & vbCrLf & _
"You are now registered to attend the course shown above."
Set objOutlook = CreateObject("Outlook.application")
Set objEmail = objOutlook.CreateItem(olMailItem)
With objEmail
.To = Me.Student_Email
.Subject = "Registration Information"
.body = strBody