Link to home
Start Free TrialLog in
Avatar of gbnorton
gbnortonFlag for United States of America

asked on

Open Access Report using varying columns

I have a table with 25 field names like this:
slot_1
slot_2
slot_3
... slot_25

I have a report that will only need one of the fields at a time.  The report should be formatted like this:
Date:              Slot_(x)
4/10/12           .011
4/10/12           .010
4/10/12           .012

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?

Thanks,
Brooks
ASKER CERTIFIED SOLUTION
Avatar of Dale Fye
Dale Fye
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of gbnorton

ASKER

Thanks a bunch for the prompt solution.
Brooks