E-mail Report

G

Guest

I am still trying to get my form e-mail command button to only send the
current record. I am either receiving error messages or my command button
doesn't work. This is what I have:
Private Sub cmdSendReport_Click()

Dim strReportName As String
Dim strCriteria As String

strReportName = "rptSendObject"
strCriteria = "[WorkOrder#]='" & Me![WorkOrder#] & " ' "
DoCmd.OpenReport strReportName, acOutputReport, , strCriteria

End Sub
 
S

Steve Schapel

MAG,

It is not clear what you are trying to do. The OpenReport method
notrmally applies to printing or previewing the report. There is no
acOutputReport option applicable to the View argument. If you are
trying to output the report to a file and send as an email attachment,
the SendObject method may be applicable. Check it out. If you still
need help after that, can you give more details of what you want to achieve.

As a completely tangential side issue... it is not a good idea to use a
# as part of the name of a field or control.
 
G

Guest

Steve,
I have a Service Request form that I have sent up to be filled out and an
email command button that automatically sends the form to the Service
Department. I have set it up as Send Object and it works, but I can't get it
to send just the current record, it sends all records. I have tried a lot of
different things, but I am not experienced enough in Access to make it work.
Thanks for your help.
MAG

Steve Schapel said:
MAG,

It is not clear what you are trying to do. The OpenReport method
notrmally applies to printing or previewing the report. There is no
acOutputReport option applicable to the View argument. If you are
trying to output the report to a file and send as an email attachment,
the SendObject method may be applicable. Check it out. If you still
need help after that, can you give more details of what you want to achieve.

As a completely tangential side issue... it is not a good idea to use a
# as part of the name of a field or control.

--
Steve Schapel, Microsoft Access MVP

I am still trying to get my form e-mail command button to only send the
current record. I am either receiving error messages or my command button
doesn't work. This is what I have:
Private Sub cmdSendReport_Click()

Dim strReportName As String
Dim strCriteria As String

strReportName = "rptSendObject"
strCriteria = "[WorkOrder#]='" & Me![WorkOrder#] & " ' "
DoCmd.OpenReport strReportName, acOutputReport, , strCriteria

End Sub
 
G

Guest

MAG,

I'm working on this for the first time as well. I'm trying to send the
current record and I have it working fine. I think my code might be a bit
simplistic, but it's working...

On Error Resume Next
DoCmd.SendObject acSendReport, ,acFormatHTML, , , ,"Service Request",,False

It's my understanding that if you leave the ObjectName blank, then it just
uses the current record. Like I said before though, I'm new to this as well,
so there may be other ways I just don't know about.

HTH

Aaron G
Philadelphia, PA

MAG said:
Steve,
I have a Service Request form that I have sent up to be filled out and an
email command button that automatically sends the form to the Service
Department. I have set it up as Send Object and it works, but I can't get it
to send just the current record, it sends all records. I have tried a lot of
different things, but I am not experienced enough in Access to make it work.
Thanks for your help.
MAG

Steve Schapel said:
MAG,

It is not clear what you are trying to do. The OpenReport method
notrmally applies to printing or previewing the report. There is no
acOutputReport option applicable to the View argument. If you are
trying to output the report to a file and send as an email attachment,
the SendObject method may be applicable. Check it out. If you still
need help after that, can you give more details of what you want to achieve.

As a completely tangential side issue... it is not a good idea to use a
# as part of the name of a field or control.

--
Steve Schapel, Microsoft Access MVP

I am still trying to get my form e-mail command button to only send the
current record. I am either receiving error messages or my command button
doesn't work. This is what I have:
Private Sub cmdSendReport_Click()

Dim strReportName As String
Dim strCriteria As String

strReportName = "rptSendObject"
strCriteria = "[WorkOrder#]='" & Me![WorkOrder#] & " ' "
DoCmd.OpenReport strReportName, acOutputReport, , strCriteria

End Sub
 
G

Guest

Aaron,
Everything is working well, except I still can't send just the current
record. Where should the ObjectName be blank, in properties or build object?
I get this message when I leave the ObjectName blank: "The Object Type
argument for the action or method is blank or invalid."
Thanks so much for your help.
MAG
Aaron G said:
MAG,

I'm working on this for the first time as well. I'm trying to send the
current record and I have it working fine. I think my code might be a bit
simplistic, but it's working...

On Error Resume Next
DoCmd.SendObject acSendReport, ,acFormatHTML, , , ,"Service Request",,False

It's my understanding that if you leave the ObjectName blank, then it just
uses the current record. Like I said before though, I'm new to this as well,
so there may be other ways I just don't know about.

HTH

Aaron G
Philadelphia, PA

MAG said:
Steve,
I have a Service Request form that I have sent up to be filled out and an
email command button that automatically sends the form to the Service
Department. I have set it up as Send Object and it works, but I can't get it
to send just the current record, it sends all records. I have tried a lot of
different things, but I am not experienced enough in Access to make it work.
Thanks for your help.
MAG

Steve Schapel said:
MAG,

It is not clear what you are trying to do. The OpenReport method
notrmally applies to printing or previewing the report. There is no
acOutputReport option applicable to the View argument. If you are
trying to output the report to a file and send as an email attachment,
the SendObject method may be applicable. Check it out. If you still
need help after that, can you give more details of what you want to achieve.

As a completely tangential side issue... it is not a good idea to use a
# as part of the name of a field or control.

--
Steve Schapel, Microsoft Access MVP


MAG wrote:
I am still trying to get my form e-mail command button to only send the
current record. I am either receiving error messages or my command button
doesn't work. This is what I have:
Private Sub cmdSendReport_Click()

Dim strReportName As String
Dim strCriteria As String

strReportName = "rptSendObject"
strCriteria = "[WorkOrder#]='" & Me![WorkOrder#] & " ' "
DoCmd.OpenReport strReportName, acOutputReport, , strCriteria

End Sub
 
S

Steve Schapel

MAG,

As far as I know, record selection is not supported by the SendObject
method. Instead, you will need to use a Query as the Record Source of
the Report, and use a Criteria in the query to select the required
record. This will use syntax such as this...
[Forms]![Service Request]![YourIdField]
.... in the criteria of the relevant field (probably your primary key
field) in the query.
 
G

Guest

Aaron,
If it is working for you, I am still interested in where you leave the
ObjectName blank.
Thanks,
MAG
Winters, Tx
Aaron G said:
MAG,

I'm working on this for the first time as well. I'm trying to send the
current record and I have it working fine. I think my code might be a bit
simplistic, but it's working...

On Error Resume Next
DoCmd.SendObject acSendReport, ,acFormatHTML, , , ,"Service Request",,False

It's my understanding that if you leave the ObjectName blank, then it just
uses the current record. Like I said before though, I'm new to this as well,
so there may be other ways I just don't know about.

HTH

Aaron G
Philadelphia, PA

MAG said:
Steve,
I have a Service Request form that I have sent up to be filled out and an
email command button that automatically sends the form to the Service
Department. I have set it up as Send Object and it works, but I can't get it
to send just the current record, it sends all records. I have tried a lot of
different things, but I am not experienced enough in Access to make it work.
Thanks for your help.
MAG

Steve Schapel said:
MAG,

It is not clear what you are trying to do. The OpenReport method
notrmally applies to printing or previewing the report. There is no
acOutputReport option applicable to the View argument. If you are
trying to output the report to a file and send as an email attachment,
the SendObject method may be applicable. Check it out. If you still
need help after that, can you give more details of what you want to achieve.

As a completely tangential side issue... it is not a good idea to use a
# as part of the name of a field or control.

--
Steve Schapel, Microsoft Access MVP


MAG wrote:
I am still trying to get my form e-mail command button to only send the
current record. I am either receiving error messages or my command button
doesn't work. This is what I have:
Private Sub cmdSendReport_Click()

Dim strReportName As String
Dim strCriteria As String

strReportName = "rptSendObject"
strCriteria = "[WorkOrder#]='" & Me![WorkOrder#] & " ' "
DoCmd.OpenReport strReportName, acOutputReport, , strCriteria

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top