email form info without attaching report

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How can I send some of the information on the form in an email message
without having to send a report?
 
The SEND command allows you to specify a subject and text for the message.
You can include strings ("This is the client number:") and fields
([ClientNumber]) from your form in the message subject or text field.
 
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."
 
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]
 
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."


[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]
 
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

[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]
 
I'm very interested in being able to do this! What did you do to make it
work?

Tom


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]
 
oh, sorry, i see you are trying to send data on a current form.
you figured it out, by now, i guess, but basically in that case you dont
need to declare a recordset at all.

your Sendobject messagetext would be like

"The new time for your class will be " & me.[classtime] & "."




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]
 
Back
Top