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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Why won't the caption changes stick? 1

Status
Not open for further replies.

kathryn

Programmer
Apr 13, 2000
776
US
Good morning, all!<br><br>I have a main form in a production application.&nbsp;&nbsp;I have written some code to test whether the linked tables used in the application are linked to the production environment, or linked to the test environment.&nbsp;&nbsp;I would like the form's caption to indicate which environment the tables are in.&nbsp;&nbsp;<br><br>I use the following code snippet<br><br>&nbsp;&nbsp;&nbsp;&nbsp;DoCmd.OpenForm &quot;frmjobsub&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;Forms![frmJobSub].Caption = &quot;Aristar FIS Production -- &quot; & strEnvironment & &quot; Environment&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;DoCmd.Save acForm, &quot;frmjobsub&quot;<br><br>This changes the caption of the form, but if I close the form and reopen it, the caption is back to the original text, which is hard-coded into the properties box of the form.<br><br>What am I missing?&nbsp;&nbsp;Having a sick child/little sleep is definitely not conducive to writing VBA ;-)<br><br>Thanks,<br>kathryn<br>
 
It's in a procedure that runs at application startup.<br><br>I can post the entire module containing all the startup procedures, but it's pretty long.<br><br>Thanks for the reply,<br>Kathryn
 
This works:<br><br>Sub test()<br>Dim strenvironment As String<br><br>DoCmd.OpenForm &quot;frmjobsub&quot;, acDesign<br>strenvironment = &quot;test&quot;<br>Forms![frmJobSub].Caption = &quot;Aristar FIS Production -- &quot; & strenvironment & &quot; Environment&quot;<br>DoCmd.Save acForm, &quot;frmjobsub&quot;<br>DoCmd.OpenForm &quot;frmjobsub&quot;<br><br>End Sub<br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top