G
Guest
How can I send some of the information on the form in an email message
without having to send a report?
without having to send a report?
jojo said:I am getting the error message User-defined type not defined. Can you tell
me what I missed in my following code? Thanks!
Private Sub OnForm_Change()
Dim dbs As dao.database
Dim rst As Recordset
Set rst = dbs.openrecordset("QryClass", dbopensnapshot)
DoCmd.SendObject , , acFormatTXT, , , , "Time Change", "The new time
is " & rst![NewTime] & " for the following class: " & rst![class
Description] & ", 0,,"
End Sub
[QUOTE="Peanut1"]
One way is to use SendObject.
create an event trigger, like with a button or something,
then declare your datasource:
dim dbs as dao.database
dim rst as recordset
set rst=dbs.openrecordset("myQueryname",dbopensnapshot)
DoCmd.SendObject(ObjectType, ObjectName, OutputFormat, To, Cc, Bcc, Subject,
MessageText, EditMessage, TemplateFile)
Your object type is just text, dont pick an object from the database. then
replace the part where it says 'MessageText' with a concatenation of your
message and some field contents (from your datasource), like:
"Good morning, you have " & rst![sumofOrders] &"orders waiting for
processing."
[QUOTE="jojo"]
How can I send some of the information on the form in an email message
without having to send a report?[/QUOTE][/QUOTE][/QUOTE]
jojo said:I got it to almost work now, however it is including all the records for that
specific field instead of the current record on the form. Also I want it to
automatically send without having me to press send on the email.
jojo said:I am getting the error message User-defined type not defined. Can you tell
me what I missed in my following code? Thanks!
Private Sub OnForm_Change()
Dim dbs As dao.database
Dim rst As Recordset
Set rst = dbs.openrecordset("QryClass", dbopensnapshot)
DoCmd.SendObject , , acFormatTXT, , , , "Time Change", "The new time
is " & rst![NewTime] & " for the following class: " & rst![class
Description] & ", 0,,"
End Sub
[QUOTE="Peanut1"]
One way is to use SendObject.
create an event trigger, like with a button or something,
then declare your datasource:
dim dbs as dao.database
dim rst as recordset
set rst=dbs.openrecordset("myQueryname",dbopensnapshot)
DoCmd.SendObject(ObjectType, ObjectName, OutputFormat, To, Cc, Bcc, Subject,
MessageText, EditMessage, TemplateFile)
Your object type is just text, dont pick an object from the database. then
replace the part where it says 'MessageText' with a concatenation of your
message and some field contents (from your datasource), like:
"Good morning, you have " & rst![sumofOrders] &"orders waiting for
processing."
:
How can I send some of the information on the form in an email message
without having to send a report?[/QUOTE][/QUOTE][/QUOTE]
jojo said:Nevermind. I figured it out. I appreciate all the help!
jojo said:I got it to almost work now, however it is including all the records for that
specific field instead of the current record on the form. Also I want it to
automatically send without having me to press send on the email.
jojo said:I am getting the error message User-defined type not defined. Can you tell
me what I missed in my following code? Thanks!
Private Sub OnForm_Change()
Dim dbs As dao.database
Dim rst As Recordset
Set rst = dbs.openrecordset("QryClass", dbopensnapshot)
DoCmd.SendObject , , acFormatTXT, , , , "Time Change", "The new time
is " & rst![NewTime] & " for the following class: " & rst![class
Description] & ", 0,,"
End Sub
:
One way is to use SendObject.
create an event trigger, like with a button or something,
then declare your datasource:
dim dbs as dao.database
dim rst as recordset
set rst=dbs.openrecordset("myQueryname",dbopensnapshot)
DoCmd.SendObject(ObjectType, ObjectName, OutputFormat, To, Cc, Bcc, Subject,
MessageText, EditMessage, TemplateFile)
Your object type is just text, dont pick an object from the database. then
replace the part where it says 'MessageText' with a concatenation of your
message and some field contents (from your datasource), like:
"Good morning, you have " & rst![sumofOrders] &"orders waiting for
processing."
:
How can I send some of the information on the form in an email message
without having to send a report?[/QUOTE][/QUOTE][/QUOTE]
jojo said:Nevermind. I figured it out. I appreciate all the help!
jojo said:I got it to almost work now, however it is including all the records for that
specific field instead of the current record on the form. Also I want it to
automatically send without having me to press send on the email.
jojo said:I am getting the error message User-defined type not defined. Can you tell
me what I missed in my following code? Thanks!
Private Sub OnForm_Change()
Dim dbs As dao.database
Dim rst As Recordset
Set rst = dbs.openrecordset("QryClass", dbopensnapshot)
DoCmd.SendObject , , acFormatTXT, , , , "Time Change", "The new time
is " & rst![NewTime] & " for the following class: " & rst![class
Description] & ", 0,,"
End Sub
:
One way is to use SendObject.
create an event trigger, like with a button or something,
then declare your datasource:
dim dbs as dao.database
dim rst as recordset
set rst=dbs.openrecordset("myQueryname",dbopensnapshot)
DoCmd.SendObject(ObjectType, ObjectName, OutputFormat, To, Cc, Bcc, Subject,
MessageText, EditMessage, TemplateFile)
Your object type is just text, dont pick an object from the database. then
replace the part where it says 'MessageText' with a concatenation of your
message and some field contents (from your datasource), like:
"Good morning, you have " & rst![sumofOrders] &"orders waiting for
processing."
:
How can I send some of the information on the form in an email message
without having to send a report?[/QUOTE][/QUOTE][/QUOTE]