Saving changes to Label Control on forms

F

faberk

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.
 
F

fredg

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"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top