change label caption on fly

cliff7376

Registered User.
Local time
Today, 20:52
Joined
Oct 10, 2001
Messages
107
I am having trouble with captions on labels. I have four labels with captions in them. i have code that automatically updates them. the problem is when i close out of my program and go back in the old label captions are back. is this becouse i am not in design mode when i cahnge them? here is my code if anyone has any suggestions please help.
im strInput As String, strMsg As String


strMsg = "Enter the date you want the new schedule to be."
strInput = InputBox(Prompt:=strMsg, _
Title:="Date", XPos:=2000, YPos:=2000)


DoCmd.SetWarnings False
Me.lbl01.Caption = Me.lbl02.Caption
Me.lbl02.Caption = Me.lbl03.Caption
Me.lbl03.Caption = Me.lbl04.Caption
Me.lbl04.Caption = strInput
DoCmd.SetWarnings True
DoCmd.Save
 
Label captions set with code will not stay unless you create some sort of permanent storage for them. If you do, you would probably want to store your values in a table and then access those values at run-time. Then if you change the labels while your program is open, make sure your code updates the table the values are stored in to be able to access them when you open your program again.

BL
hth
 

Users who are viewing this thread

Back
Top Bottom