Variable Label Box

Noreen

Registered User.
Local time
Today, 23:25
Joined
Sep 27, 2010
Messages
30
Hi,

I want to insert a label box (title)in a form that will display text that depends on what the user picks from a combo box as it will linked to a main form through a button?

Is this possible?

Thanks for your help in advance of it
Noreen

P.S I am looking for a lot of help today so I hope you can help!!!
 
The simple answer to your question: "Is this possible" is Yes.

You can use a Select Case statement in the After Update event of your combo box to update the "Caption" property of your label to be what you want for each item listed in the combo box.

Hope this helps.
 
The simple answer to your question: "Is this possible" is Yes.

You can use a Select Case statement in the After Update event of your combo box to update the "Caption" property of your label to be what you want for each item listed in the combo box.

Hope this helps.

Hi,

I'm not the best with SQL but could you please give me a hand to write the code?

Thanks, Noreen
 
Hi,

I'm not the best with SQL but could you please give me a hand to write the code?

Thanks, Noreen

That isn't SQL. It is VBA and it would be something like this (let's say your combo box has 3 items - "Yes", "No", and "Maybe" with ID's of 0, 1, 2:
Code:
Select Case Me.YourComboBoxNameHere
Case 0
    Me.YourLabelName.Caption = "You chose 'Yes'"
Case 1
    Me.YourLabelName.Caption = "You chose 'No'"
Case 2
    Me.YourLabelName.Caption = "You chose 'Maybe'"
End Select

And if the combo has the value you want to display you can concatenate it in:

Code:
Me.YourLabelName.Caption = "You chose '" & Me.YourComboBoxNameHere.Column(1) & "'"

or if the value you want is the bound column:
Code:
Me.YourLabelName.Caption = "You chose '" & Me.YourComboBoxNameHere & "'"

Hope that helps.
 
That isn't SQL. It is VBA and it would be something like this (let's say your combo box has 3 items - "Yes", "No", and "Maybe" with ID's of 0, 1, 2:
Code:
Select Case Me.YourComboBoxNameHere
Case 0
    Me.YourLabelName.Caption = "You chose 'Yes'"
Case 1
    Me.YourLabelName.Caption = "You chose 'No'"
Case 2
    Me.YourLabelName.Caption = "You chose 'Maybe'"
End Select

And if the combo has the value you want to display you can concatenate it in:

Code:
Me.YourLabelName.Caption = "You chose '" & Me.YourComboBoxNameHere.Column(1) & "'"

or if the value you want is the bound column:
Code:
Me.YourLabelName.Caption = "You chose '" & Me.YourComboBoxNameHere & "'"

Hope that helps.
Yes that helps and worked.
 

Users who are viewing this thread

Back
Top Bottom