Fields in subject line

I

iblonger

I have pieced together code to print preview and email a report for the
record that is currently open in the form. Now my boss wants some of the
data to show up in the subject line automatically. Any ideas?
 
I

iblonger

I am using the SendObject function. So I can use the area of the code for
subject to pull data from the fields I specify within the current code? Or am
I going to have to write a bunch more.
Thanks,
Bradley
 
A

Al Camp

The Subject argument of SendObject can be a string like...
DoCmd.SendObject , , , "[email protected]", , , "This is the Subject"
entered directly into the SendObject argument...

or it can be a text control value like [MySubjectText]

Check out SendObject in Help
 
I

iblonger

Here is the code I am using and it is working perfect except I want it to
pull the record number into the subject area of the SendObject DoCmd from the
form I am currently working in. I have tried a couple different things to
pull the record number but to no avail.

Private Sub cmdPrint_Click()
On Error GoTo Err_cmdPrint_Click
Dim strWhere As String

If Me.Dirty Then
Me.Dirty = False
End If

If Me.NewRecord Then
MsgBox "Select a record to print"
Else
strWhere = "[Record Number] = " & Me.[Record Number]
DoCmd.OpenReport "Report", acViewPreview, , strWhere
DoCmd.SendObject acReport, "Report", acFormatSNP,
"[email protected];[email protected];[email protected];[email protected];[email protected];[email protected];[email protected];[email protected]", , , "Kalas Rejection", , True
Exit_cmdPrint_Click:
Exit Sub

Err_cmdPrint_Click:
If Err.Number = 2501 Then
Resume Next
MsgBox Err.Description
End If

Resume Exit_cmdPrint_Click
End If

End Sub
Thanks much,

Al Camp said:
The Subject argument of SendObject can be a string like...
DoCmd.SendObject , , , "[email protected]", , , "This is the Subject"
entered directly into the SendObject argument...

or it can be a text control value like [MySubjectText]

Check out SendObject in Help
--
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions

iblonger said:
I am using the SendObject function. So I can use the area of the code for
subject to pull data from the fields I specify within the current code? Or
am
I going to have to write a bunch more.
Thanks,
Bradley
 
A

Al Camp

iblonger,
I tested this on a form, and it worked. Since you have a report open at
the time of the SendObject, you'll have to refer to the Subject argument
as...
Forms!YourFormName!RecordNumber (No quotes)
That should fly...

Also, if you email this to the same people all the time, you might want
to create a "Group" in OE, and use the Group name as the TO argument.
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions

iblonger said:
Here is the code I am using and it is working perfect except I want it to
pull the record number into the subject area of the SendObject DoCmd from
the
form I am currently working in. I have tried a couple different things to
pull the record number but to no avail.

Private Sub cmdPrint_Click()
On Error GoTo Err_cmdPrint_Click
Dim strWhere As String

If Me.Dirty Then
Me.Dirty = False
End If

If Me.NewRecord Then
MsgBox "Select a record to print"
Else
strWhere = "[Record Number] = " & Me.[Record Number]
DoCmd.OpenReport "Report", acViewPreview, , strWhere
DoCmd.SendObject acReport, "Report", acFormatSNP,
"[email protected];[email protected];[email protected];[email protected];[email protected];[email protected];[email protected];[email protected]",
, , "Kalas Rejection", , True
Exit_cmdPrint_Click:
Exit Sub

Err_cmdPrint_Click:
If Err.Number = 2501 Then
Resume Next
MsgBox Err.Description
End If

Resume Exit_cmdPrint_Click
End If

End Sub
Thanks much,

Al Camp said:
The Subject argument of SendObject can be a string like...
DoCmd.SendObject , , , "[email protected]", , , "This is the Subject"
entered directly into the SendObject argument...

or it can be a text control value like [MySubjectText]

Check out SendObject in Help
--
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions

iblonger said:
I am using the SendObject function. So I can use the area of the code
for
subject to pull data from the fields I specify within the current code?
Or
am
I going to have to write a bunch more.
Thanks,
Bradley

:

I have pieced together code to print preview and email a report for
the
record that is currently open in the form.
What code?

If you're using the SendObject function, then utilize the "Subject"
argument.
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions


I have pieced together code to print preview and email a report for
the
record that is currently open in the form. Now my boss wants some
of
the
data to show up in the subject line automatically. Any ideas?
 
I

iblonger

It worked perfectly, when I tried that previously I had it in the quotes.
Thanks so much for the help.

Al Camp said:
iblonger,
I tested this on a form, and it worked. Since you have a report open at
the time of the SendObject, you'll have to refer to the Subject argument
as...
Forms!YourFormName!RecordNumber (No quotes)
That should fly...

Also, if you email this to the same people all the time, you might want
to create a "Group" in OE, and use the Group name as the TO argument.
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions

iblonger said:
Here is the code I am using and it is working perfect except I want it to
pull the record number into the subject area of the SendObject DoCmd from
the
form I am currently working in. I have tried a couple different things to
pull the record number but to no avail.

Private Sub cmdPrint_Click()
On Error GoTo Err_cmdPrint_Click
Dim strWhere As String

If Me.Dirty Then
Me.Dirty = False
End If

If Me.NewRecord Then
MsgBox "Select a record to print"
Else
strWhere = "[Record Number] = " & Me.[Record Number]
DoCmd.OpenReport "Report", acViewPreview, , strWhere
DoCmd.SendObject acReport, "Report", acFormatSNP,
"[email protected];[email protected];[email protected];[email protected];[email protected];[email protected];[email protected];[email protected]",
, , "Kalas Rejection", , True
Exit_cmdPrint_Click:
Exit Sub

Err_cmdPrint_Click:
If Err.Number = 2501 Then
Resume Next
MsgBox Err.Description
End If

Resume Exit_cmdPrint_Click
End If

End Sub
Thanks much,

Al Camp said:
The Subject argument of SendObject can be a string like...
DoCmd.SendObject , , , "[email protected]", , , "This is the Subject"
entered directly into the SendObject argument...

or it can be a text control value like [MySubjectText]

Check out SendObject in Help
--
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions

I am using the SendObject function. So I can use the area of the code
for
subject to pull data from the fields I specify within the current code?
Or
am
I going to have to write a bunch more.
Thanks,
Bradley

:

I have pieced together code to print preview and email a report for
the
record that is currently open in the form.
What code?

If you're using the SendObject function, then utilize the "Subject"
argument.
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions


I have pieced together code to print preview and email a report for
the
record that is currently open in the form. Now my boss wants some
of
the
data to show up in the subject line automatically. Any ideas?
 
Top