Help Please - Changing Column Lables Programatically

Kevin Robson

Registered User.
Local time
Today, 15:12
Joined
Feb 4, 2004
Messages
12
I have a subfom that displays perfectly in datsheet view.

One of the columns changes its contents depending on a value. i.e. a list of units or a list of costs. I change the data using a Recordset update.

When in the Main Form I am trying to change the column label that appears in the SubForm header above the column, to either 'Units' or 'Cost, to match the data.

I am strugging to find the correct syntax, can anyone help?

Also, can I change this via the Recordset update?

Thanks :confused:
 
can you copy and paste the code you are using in the update recordset please.

Alastair
 
Alastair,
This is an extract:

MyRecordSet.Addnew
MyRecordSet.Fields("RefNum") = TmpCostProfile("RefNum")
MyRecordSet.Fields("Volume") = TmpCostProfile("Volume")

Select Case TmpCostDriver.Fields("Type")
Case "Units"
MyRecordSet.Fields("Units") = TmpCostProfile ("Units")
'Change Label to 'Units'
MyRecordSet.Label("Column3").Caption = "Units" '******** Problem Line

Case "Cost"
MyRecordSet.Fields("Proportion") = TmpCostProfile ("Cost")
'Change Label to 'Cost'
MyRecordSet.Label("Column3").Caption = "Cost" '******** Problem Line

End Select

MyRecordSet.Update


Thanks for the response. Hope this helps
 
Right got an understanding.

The command:

MyRecordSet.Label("Column3").Caption = "Units" '******** Problem Line

will give you an error as this is trying to change the table caption not the form text caption, you can not do it this way i would say you would need some thing like.

me.lable23.caption = "Units"

Alastair
 

Users who are viewing this thread

Back
Top Bottom