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

Different controltip message dependent on combo box

Status
Not open for further replies.

icsupt

MIS
Jun 14, 2004
150
US
I have a combo box haircolor that the user chooses different values. What I want to have happen is when the user chooses a option in the combo box, when they tab to the field addtlinfo, I want the controltip to be dependent on what choice they made in the combo box.

So for instance, if value in combo box haircolor = red, the controltip in the field addtlinfo, should be "this is a special order".

If value in combo box haircolor= black, the controltip in the field addtlinfo, should be "this is located on back shelf".

Thanks in advance for any help I get.
 
Hoe are ya icsupt . . . . .

In the [blue]AfterUpdate[/blue] event of the combobox, copy/paste the following:
Code:
[blue]   Dim HairColor As String, Prp As Property
   
   Set Prp = Me!AddTlInfo.Properties("ControlTipText")
   HairColor = Me!HairColor.Column(1)
   
   If HairColor = "Red" Then
      Prp = "This is a special order"
   ElseIf HairColor = "Black" Then
      Prp = "this is located on back shelf"
   ElseIf HairColor = "Blue" Then
      Prp = "? ? ?"
            [green]'
            '
            '[/green]
   ElseIf HairColor = "Gray" Then
      Prp = "? ? ?"
   Else
      Prp = "? ? ?"
   End If[/blue]
I believe you get the Idea! . . . . .

Calvin.gif
See Ya! . . . . . .
 
Thanks for quick reply. When I paste your code in, I'm getting ? ? ?. I also believe I misstated what I wanted. Instead of Controltiptext, I believe it should be StatusBarText.

I also already have something in the AfterUpdate. My question - where do I paste the code you provided?

Private Sub Servicescmb_AfterUpdate()
Dim varOwner As Variant
Dim varCommittedDays As Variant
Dim bEm As Boolean


If Not (IsNull(Servicescmb)) Then

varOwner = DLookup("Owner", "tblServices", "Services1 = [Services]")
varCommittedDays = DLookup("CommittedDays", "tblServices", "Services1 = [Services]")
bEm = DLookup("Em", "tblServices", "Services1 = [Services]")

'---
'set Exceptem based on EM field in the tblServices table
If bEm = True Then
Me![Exceptem] = True
Else
Me![Exceptem] = False
End If

If (Not IsNull(varOwner)) Then Me![Owner] = varOwner
If (Not IsNull(varCommittedDays)) Then Me![CommittedDays] = varCommittedDays

Select Case Servicescmb
Case Is = "SL", "CR", "HS"
Me.CommittedDays.SetFocus
Case Else
Me.DateSubmit.SetFocus
End Select


End If

End Sub
 
OK icsupt . . . . .

Replace your code with the following:
Code:
[blue]   Dim varOwner, varCommittedDays, bEm As Boolean
   [b]Dim HairColor As String, Prp As Property
 
   Set Prp = Me!AddTlInfo.Properties("[b]StatusBarText[/b]")
   HairColor = Me!HairColor.Column(1)[/b]
 
   If Not (IsNull(Servicescmb)) Then
   
       varOwner = DLookup("Owner", "tblServices", "Services1 = [Services]")
       varCommittedDays = DLookup("CommittedDays", "tblServices", "Services1 = [Services]")
       bEm = DLookup("Em", "tblServices", "Services1 = [Services]")
       
       [green]'---
       'set Exceptem based on EM field in the tblServices table[/green]
       If bEm = True Then
          Me![Exceptem] = True
       Else
          Me![Exceptem] = False
       End If
   
       If (Not IsNull(varOwner)) Then Me![Owner] = varOwner
       If (Not IsNull(varCommittedDays)) Then Me![CommittedDays] = varCommittedDays
       
       Select Case Servicescmb
       Case Is = "SL", "CR", "HS"
          Me.CommittedDays.SetFocus
       Case Else
          Me.DateSubmit.SetFocus
       End Select
   End If
  
   [green]'StatusBar prompts here[/green]
   [b]If HairColor = "Red" Then
      Prp = "This is a special order"
   ElseIf HairColor = "Black" Then
      Prp = "this is located on back shelf"
   ElseIf HairColor = "Gray" Then
      Prp = "[purple][b]Your StatusBar Text Here[/b][/purple]"
   End If
   
   Set Prp = Nothing[/b][/blue]
Give it a whirl & let me know . . . . .

Calvin.gif
See Ya! . . . . . .
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top