Tried the code:
Code:
Me.SFSB_SCHEDULE_TMP.Form.COL1.Controls(0).Caption = Me.COL1
Got a Run-time error '2455':
You entered an expression that has an invalid reference to the property Form/Report
Got the same error when I tried:
Code:
Me.SFSB_SCHEDULE_TMP.Form.Controls("COL1").Caption = Me.COL1
COL1 is the name of an unbound text control on the parent form and a bound text control on the subform. The field names are generic because the subform's recordsource (a table) was created to act something like a pivot table where fields COL1 through COL9 could contain data from any number of current work centers. So, I am trying to accomplish the following:
1) User selects on the parent form whether they want to see data for one work center (ie "LINE1", "LINE2", etc or "All")
2) If it's just one value, then after much behind the scenes code, the subform's recordsource is only going to contain COL1 data but the subform's COL1's datasheet caption needs to be equal to the value the user selected on the parent form (ie "LINE1", "LINE2", etc).
3) If the user selected "All" then code gathers a listing of all the work centers to gather data for, gathers the data, and populates the subform's recordsouce with up to 9 columns of data. The subform's COL1, COL2, COL3, etc datasheet caption needs to equal the parent form's values for COL1, COL2, COL3, etc. For instance parent form COL1 value = "LINE1". The subform's COL1 datasheet caption needs to be "LINE1".
The COL fields on the parent form are going to be hidden once this setting the datasheet caption thing works. It will only be on the parent form so that there will be a value to use to set the subform field's datasheet captions. Or, in a perfect world, get rid of the parent form COL fields altogether and when I get the listing of work centers, just use those values to update the subform's datasheet captions with....