When I call a sub procedure located in my Report's from my main form using hard coded values, I am able to call a report with no problem.
This works:
DoCmd.OpenReport Bridge_Rpt, acViewReport, , , acHidden
Me.Bridge_Rpt.Report.Min_Max_Val("Bridge_Tbl", "ST")
But what I really need is to be able to use string variables b/c there are different reports based on what the user selects. I've tried the following with no luck:
DoCmd.OpenReport selected_rpt, acViewReport, , , acHidden
Me.[selected_rpt].Report.Min_Max_Val(Tbl_Name, Selected_UoM)
selected_rpt = name of report user selected
Tbl_Name = table associated with the report
Selected_UoM = the unit of measure the user selected
I am getting the following error:
Microsoft Access cannot find the field '|1'referred to in your expression
What is the correct way to call a sub procedure in a report without having to hard code it? By the way, as a test, I placed a MsgBox "Hello" as the 1st line in the Report sub procedure Min_Max_Val but it doesn't get past the Call to the report procedure. I never get the message box popup with Hello.