Open Access Report using varying columns
Posted on 2012-04-10
I have a table with 25 field names like this:
I have a report that will only need one of the fields at a time. The report should be formatted like this:
The data in the slot column will vary depending on which slot is being used.
I have the field name from a non visible text box on the form that opens the report.
The report is opened like this:
strWhere = "Select Burn_In_Date, " & strSlot
strWhere = strWhere & " FROM Part_Voltage"
strWhere = strWhere & " WHERE (((Part_Voltage.BurnIn_Date) Between [Forms]![frm_rpt_Report1]![txtBurn_In_Start] And DateAdd("
strWhere = strWhere & "'h'"
strWhere = strWhere & ",20,[Forms]![frm_rpt_Report1]![txtBurn_In_Start])));"
DoCmd.OpenReport "rpt_PartVoltage", acViewPreview, strWhere
Can I use a variable for a field name?
Some other way?