I am having trouble with a control button on a subform. I have the button set when it is click to view a report based on the current Primary field [ID]. Here is the code I have placed in the on click event. Of course that is between the two bits of code provide when you enter the code builder.
DoCmd.OpenReport "rptInvoice", acViewPreview, , "[ID]= Forms!frmMKInvoice!ID"
If I go to the subform frmMKInvoice and click the button it pulls the report like I want it to.
If I click on it while in the main form I get a box that wants me to enter the value for Forms!frmMKInvoice!ID. if I click cancel it bring up an error telling me I have a runtime error.
Do I have to do this different to get it work from a subform while viewing in a main form?
Thanks for any help
DoCmd.OpenReport "rptInvoice", acViewPreview, , "[ID]= Forms!frmMKInvoice!ID"
If I go to the subform frmMKInvoice and click the button it pulls the report like I want it to.
If I click on it while in the main form I get a box that wants me to enter the value for Forms!frmMKInvoice!ID. if I click cancel it bring up an error telling me I have a runtime error.
Do I have to do this different to get it work from a subform while viewing in a main form?
Thanks for any help