Dymanic labels on forms: Possible? (1 Viewer)

theKruser

Registered User.
Local time
Today, 04:47
Joined
Aug 6, 2008
Messages
122
Is it possible to change form labels to display info that depends on the selection of a combo box?

For example, suppose:
tblFormData
-FormDataID (PK)
-FormLabelsID (FK)
-Text1
-Text2
-Text3
-Text4

tblFormLabels
-FormLabelsID (PK)
-LabelForTxtText1
-LabelForTxtText2
-LabelForTxtText3
-LabelForTxtText4

frmDataEntry
-cboFormLabelsID
-lblText1
-txtText1
-lblText2
-txtText2
-lblText3
-txtText3
-lblText4
-txtText4

The labels on frmDataEntry should change dynamically with the selection made in cboFormLabelID. All boxes in frmDataEntry will store a value in tblFormData.

The reasoning behind this request is to be able to "create" new forms by entering records in tblFormLabels. I say "create," but in actuality there will only be the one form, just the labels on the text boxes will change depending on the selection made.

Iknow I basically just repeated myself, but I don't really know how else to explain it. If I am not conveying my thoughts well, please let me know. Thanks in advance for any help you can give.
 

John Big Booty

AWF VIP
Local time
Today, 18:47
Joined
Aug 29, 2005
Messages
8,262
In the On Change event of the combo you could use something like;
Code:
Me.YourLabelName.Caption = Me.ComboName

You would also need to have some similar code in the form's On Current event.

The exact nature of the code will be dependant on where the information you wish to form the Caption of the label is coming from.
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 09:47
Joined
Sep 12, 2006
Messages
15,729
i dont quite understand -

but you can get at other columns of a combo box

mylabel.caption = mycombobox.column(x)

where x is 0 based number of all columns in cbo source (not just visible columns)

-----
note that a lot of people use text boxes for this - set them locked= true, enabled=false

then you can have the control source set to

= mycombobox.column(x)

and they will update on change automatically without any code needed.
 

Users who are viewing this thread

Top Bottom