OLE action works on form but not report

R

Robin

I have a form and report that show a small half page word 2007 docx used for
editable advertising on a one page report. I have created a command button
on another form to select the file .docx that the user would like to replace
the current AD .docx with.

The UnboundOLE frame will update on the form but not the report. The code is:


Private Sub cmdChangeAD_Click()
On Error GoTo Err_cmdChangeAD_Click

' Allows User to select file for new AD copy on the Billing Invoices.

Me!BillingMemo = BrowseForFile("Please Select Desired Word Document")

' Opens the form and updates the Source Doc property of the ole field.

DoCmd.OpenForm "InvoicesToPrintForm", acNormal, , , acFormPropertySettings,_
acHidden
Forms!InvoicesToPrintForm.Controls!OLEUnbound49.Class = "word.docx"
Forms!InvoicesToPrintForm.Controls!OLEUnbound49.OLETypeAllowed =_ acOLELinked
Forms!InvoicesToPrintForm.Controls!OLEUnbound49.SourceDoc = Me!BillingMemo
Forms!InvoicesToPrintForm.Controls!OLEUnbound49.Action = acOLECreateLink
DoCmd.Close acForm, "InvoicesToPrintForm", acSaveYes

' Opens the report and updates the Source Doc property of the ole field.

DoCmd.OpenReport "rptBillingInvoice", acViewReport, , , acHidden
Reports!rptBillingInvoice.Controls!OLEUnbound42.Class = "Word.Document.12"
Reports!rptBillingInvoice.Controls!OLEUnbound42.OLETypeAllowed = acOLELinked
Reports!rptBillingInvoice.Controls!OLEUnbound42.SourceDoc = Me!BillingMemo
Debug.Print Me!BillingMemo
Reports!rptBillingInvoice.Controls!OLEUnbound42.Action = acOLECreateLink
DoCmd.Close acReport, "rptBillingInvoice", acSaveYes


Exit_cmdChangeAD_Click:
Exit Sub

Err_cmdChangeAD_Click:
MsgBox Err.Description
Resume Exit_cmdChangeAD_Click
End Sub
Any suggestions would be appreciated.

Thank you,
Robin
 

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