Okay, I've written a report which accesses the records in the table involved for a given Fiscal Year and Point-of-Contact person. The criteria are entered into combo boxes on a form, and VBA code runs it with the command line:
DoCmd.OpenReport strReportName, acViewPreview, , strSQL
where strReportName holds the name of the report, and strSQL is the 'WhereCondition' specifying the criteria, created from the combo boxes:
strSQL = "[Fiscal Year]='" & Me!cboFY.Column(0) & "' And [POC]='" & Me!cboPOC.Column(0) & "'"
The header of the report is a text box with a formula that references both [Fiscal Year] and [POC] to show the fiscal year and Point-of-Contact involved.
The thing is, if no records are found for the given criteria, the header reads #Error. I can insert an IIf(IsError([Fiscal Year]),"(no data)",[Fiscal Year]) check (and the same for [POC]), but I thought if I referenced the combo boxes on the form instead I could avoid the whole problem.
Unfortunately, when I make the header source data:
="Report for " & frmMainForm!cboPOC.Column(0) & " During FY " & frmMainForm!cboFY.Column(0)
MS Access changes it to:
="Report for " & [frmMainForm]![cboPOC].[Column](0) & " During FY " & [frmMainForm]![cboFY].[Column](0)
which, well, doesn't work. Is there a proper format to "fetch" the value of a field on a form into a report?