Link to home
Start Free TrialLog in
Avatar of mainrotor
mainrotor

asked on

Is there a way to dynamically change the column captions on an ACCESS 2010 subform

Hi Experts,
Is there a way to dynamically change the column captions on an ACCESS 2010 subform.


Thank you very much in advance,
mrotor
Avatar of Gustav Brock
Gustav Brock
Flag of Denmark image

Yes, if the control has an associated label:

Me!SubformControlName.Form!FieldName.Controls(0).Caption = "New Caption"

/gustav
Is your subform a form, or is the SourceObject of the subform control actually a query?
Avatar of James Bailey
James Bailey

Is the form in datasheet view, perchance/
Avatar of mainrotor

ASKER

Dale Fye,
The SourceObject of the subform is actually a query.  Here's a sample of the code:

    Dim pSQL As String

    pSQL = "SELECT * FROM Staging_Table ORDER BY Staging_Table.Tech_Name"

    Me.dataAvailabilitySubform.SourceObject = "Query.qryStagingTable"
    Me.dataAvailabilitySubform.Form.RecordSource = pSQL
    Me.dataAvailabilitySubform.Requery

Open in new window


Thanks,
mrotor
James Bailey,
My subform is in datasheet view.  How can I change the column names dynamically?

User generated image
Thank you,
mrotor
If the control does not have an associated label:

Create a label.
Mark the label and press Ctrl+X
Mark the column and press Ctrl+V

Then:
https://www.experts-exchange.com/questions/28650357/Is-there-a-way-to-dynamically-change-the-column-captions-on-an-ACCESS-2010-subform.html?anchorAnswerId=40707497#a40707497

/gustav
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