1
votes

Access newbie here. I have an unbound form with a ComboBox cmb_SelProdName bound to AlloyName of my MDB. The user selects an Alloy Name from the box, and a Form button On Click event does a DoCmd.OpenReport which should pass the AlloyName to the report "rpt_xTest":

DoCmd.OpenReport "rpt_xTest", acViewReport, , , , OpenArgs:=Me.cmb_SelProdName

On the (unbound) report is a bound text box with =[Forms]![OpenArgs] which should display the value in the combobox.

What happens is, I select the alloy I want, press the button, and immediately get a dialogue asking for "Sample Name". When I type anything, I go to my blank report with #Error in my text box.

I'm stuck at this point and desperate for tips.

1

1 Answers

0
votes

Your text box displays #Error because [Forms]![OpenArgs] means a form object named OpenArgs which is currently open in Form View.

But I think you actually want the value of the OpenArgs option which was supplied with DoCmd.OpenReport. If that is correct, use this as the Control Source property for your text box:

=[OpenArgs]

I tested that with for a report text box with Access 2007.