Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

change caption propery programatically

Status
Not open for further replies.

lamlancer

Technical User
Jul 13, 2005
4
CA
i can successfully change a button caption in an open form using

Command1.Caption = "new caption"
DoCmd.Save acForm, "formname"

but when i close the form and reopen it my new caption is not appearing

???

thanks for any assistance
 
I'm not sure why you posted this in the Reports forum. However, you can't save these changes unless you are in the design view of your report or form.

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
i am a rookie to tek tips

yes i guess my question is more appropriately for another forum

thanks for pointing that out

seeing as how it is here though i thought id also try my next question which would be

how do i programatically get in the design view of the form

thanks again
 
I don't think you want to get into design view of your form with code. There are probably a half dozen better solutions. For instance:
Create a small lookup table:
[tt][blue]
tblMyValues
================
ValueName text
TheValue text
[/blue][/tt]
For now, add one record:
[tt][blue]
ValueName TheValue
=========== =============
FormACaption My New Caption
[/blue][/tt]

In the On Open event of FormA, add this code:
Code:
If Not IsNull(DLookup("TheValue","tblMyValues","ValueName='FormACaption'")) Then
   Me.Caption = (DLookup("TheValue","tblMyValues","ValueName='FormACaption'")
End If

Now, you maintain values in tables rather than changing code.

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top