Prev: Set Value Macro
Next: Wrong time
From: J.Bennett on 17 Mar 2010 23:05 I have a form that has a button to run an "event Procedure" to preview a report, and to email the report as a pdf attachment. The codes I use are as follows: Private Sub emailfullpricesheet_Click() DoCmd.OpenReport "Full Price Sheet", acViewPreview, , , acWindowNormal DoCmd.SendObject acSendReport, "Full Price Sheet", acFormatPDF, , , , [DLRName], _ "Thank You for your business.", True End Sub In this code, I have the field for the dealer name (shown above as [DLRName]) where it would be placed in the subject line. However, when I run this button with any field name included, I get an error message as follows: Run-time error '2465' Microsoft Office Access can't find the filed '|' referenced in our expression. The field name is correct. I have even tried other field names from the query. Additionally, this field name is on the report produced in the first commad of the event procedure and the report is displayed correctly. Can anyone help with what I am doing wrong that prevents fields from being displayed? Otherwise, I can simply use an embedded Macro. However, I want the ability to reference the specific dealer information. Any help would be greatly appreciated. Frustrated!!!!!
From: Rick Brandt on 18 Mar 2010 07:23 J.Bennett wrote: > I have a form that has a button to run an "event Procedure" to preview a > report, and to email the report as a pdf attachment. The codes I use are > as follows: > > Private Sub emailfullpricesheet_Click() > > DoCmd.OpenReport "Full Price Sheet", acViewPreview, , , acWindowNormal > DoCmd.SendObject acSendReport, "Full Price Sheet", acFormatPDF, , , , > [DLRName], _ > "Thank You for your business.", True > > End Sub > > In this code, I have the field for the dealer name (shown above as > [DLRName]) where it would be placed in the subject line. However, when I > [run > this button with any field name included, I get an error message as > follows: > > Run-time error '2465' > Microsoft Office Access can't find the filed '|' referenced in our > expression. > > The field name is correct. I have even tried other field names from the > query. Additionally, this field name is on the report produced in the > first commad of the event procedure and the report is displayed correctly. > > Can anyone help with what I am doing wrong that prevents fields from being > displayed? Otherwise, I can simply use an embedded Macro. However, I > want the ability to reference the specific dealer information. SendObject has no access to any of the fields in the report. Code within the report's own events can access field data but SendObject is running external to the report and has no "knowledge" of the data the report is using.
|
Pages: 1 Prev: Set Value Macro Next: Wrong time |