If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
SendObject doesn't find fields in querry
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!!!!! |
#2
|
|||
|
|||
SendObject doesn't find fields in querry
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. |
Thread Tools | |
Display Modes | |
|
|