Update the default value of a form text control.

C

Coxrail2

I have a control on a form named
[Forms]![frmPrintClaimMaint]![strHeadingText]. The control is used to print
text in a report header. Users can print reports using the control's default
text, or modify the text for their specific needs. The form is used
sporadically, so the default text becomes dated after a while. Therefore, I
want to allow users to change the control's default text.

I was thinking a simple macro attached to a button ought to do the trick. My
conceptual approach was to allow the user to type in new text, either in
strHeadingText or in another control such as strTempText. The macro would use
a sequence something like:

SetValue
Item: [Forms]![frmPrintClaimMaint]![strHeadingText].[DefaultValue]
Expression: [Forms]![frmPrintClaimMaint]![strTempText]

Save
Object Type: Form
Object Name: frmPrintClaimMaint

RepaintObject
Object Type: Form
Object Name: frmPrintClaimMaint

This approach fails to update the default value. Any thoughts? Is a macro a
usable approach, or should I go to VB? Whichever approach, I cannot seem to
discover my error.
 
W

Wolfgang Kais

Hello "Coxrail2".

Coxrail2 said:
I have a control on a form named
[Forms]![frmPrintClaimMaint]![strHeadingText]. The control is used
to print text in a report header. Users can print reports using the
control's default text, or modify the text for their specific needs.
The form is used sporadically, so the default text becomes dated
after a while. Therefore, I want to allow users to change the
control's default text.

I was thinking a simple macro attached to a button ought to do the
trick. My conceptual approach was to allow the user to type in new
text, either in strHeadingText or in another control such as
strTempText. The macro would use a sequence something like:

SetValue
Item: [Forms]![frmPrintClaimMaint]![strHeadingText].[DefaultValue]
Expression: [Forms]![frmPrintClaimMaint]![strTempText]

Save
Object Type: Form
Object Name: frmPrintClaimMaint

RepaintObject
Object Type: Form
Object Name: frmPrintClaimMaint

To permanently change the default value of the textbox, you will
have to open the form in design view (which can be hidden) from
womewhere outside the form, change the default value and then
close and save the form.
But I think that this would not be a good approach, because this
would mean changing the design while users work with the form.
It might be a better approach to store the new default value in a
table and read that value and set the default value in the open
event of the form. This way, each user could have an other value.
 
C

Coxrail2

This helps. Thanks.
--
TCox


Wolfgang Kais said:
Hello "Coxrail2".

Coxrail2 said:
I have a control on a form named
[Forms]![frmPrintClaimMaint]![strHeadingText]. The control is used
to print text in a report header. Users can print reports using the
control's default text, or modify the text for their specific needs.
The form is used sporadically, so the default text becomes dated
after a while. Therefore, I want to allow users to change the
control's default text.

I was thinking a simple macro attached to a button ought to do the
trick. My conceptual approach was to allow the user to type in new
text, either in strHeadingText or in another control such as
strTempText. The macro would use a sequence something like:

SetValue
Item: [Forms]![frmPrintClaimMaint]![strHeadingText].[DefaultValue]
Expression: [Forms]![frmPrintClaimMaint]![strTempText]

Save
Object Type: Form
Object Name: frmPrintClaimMaint

RepaintObject
Object Type: Form
Object Name: frmPrintClaimMaint

To permanently change the default value of the textbox, you will
have to open the form in design view (which can be hidden) from
womewhere outside the form, change the default value and then
close and save the form.
But I think that this would not be a good approach, because this
would mean changing the design while users work with the form.
It might be a better approach to store the new default value in a
table and read that value and set the default value in the open
event of the form. This way, each user could have an other value.
 
C

Coxrail2

This helped. Thanks.
--
TCox


Wolfgang Kais said:
Hello "Coxrail2".

Coxrail2 said:
I have a control on a form named
[Forms]![frmPrintClaimMaint]![strHeadingText]. The control is used
to print text in a report header. Users can print reports using the
control's default text, or modify the text for their specific needs.
The form is used sporadically, so the default text becomes dated
after a while. Therefore, I want to allow users to change the
control's default text.

I was thinking a simple macro attached to a button ought to do the
trick. My conceptual approach was to allow the user to type in new
text, either in strHeadingText or in another control such as
strTempText. The macro would use a sequence something like:

SetValue
Item: [Forms]![frmPrintClaimMaint]![strHeadingText].[DefaultValue]
Expression: [Forms]![frmPrintClaimMaint]![strTempText]

Save
Object Type: Form
Object Name: frmPrintClaimMaint

RepaintObject
Object Type: Form
Object Name: frmPrintClaimMaint

To permanently change the default value of the textbox, you will
have to open the form in design view (which can be hidden) from
womewhere outside the form, change the default value and then
close and save the form.
But I think that this would not be a good approach, because this
would mean changing the design while users work with the form.
It might be a better approach to store the new default value in a
table and read that value and set the default value in the open
event of the form. This way, each user could have an other value.
 

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