Saving changes to Label Control on forms

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to make changes to Label controls on a form, programically. I
attempt to save the form, which is named "frmCostCenter" after the changes,
using:

DoCmd.Save acForm, "frmCostCenter"

Yes, the form is open :-)

It is evident the changes are not saved wen I re-open the form. What am I
doing wrong?

Many thanks.
 
I am trying to make changes to Label controls on a form, programically. I
attempt to save the form, which is named "frmCostCenter" after the changes,
using:

DoCmd.Save acForm, "frmCostCenter"

Yes, the form is open :-)

It is evident the changes are not saved wen I re-open the form. What am I
doing wrong?

Many thanks.

To save your changes you must make the changes in Design View, and
then save the changes.
This can be done programmatically, using code from an event on the
form while it's already open.

DoCmd.OpenForm "FormName", acDesign , , , , acHidden
'Change your labels here.
forms!FormName!LabelName.Caption = "Something else"
DoCmd.Close acForm "FormName", acSaveYes
'Reopen the form if you wish
DoCmd.OpenForm "FormName"
 
Back
Top