custom msgbox??

ekta

Registered User.
Local time
Today, 17:08
Joined
Sep 6, 2002
Messages
160
Hi:

I have a combobox on my form called cboType. The values in this combobox are Active, Pending, Retired, Lost. I want to display a custom message box when a user changes value in the combobox. The msgbox will display different message everytime depending on the selection. I don't want the msgbox to pop up when they add a new record. Only when they change the value in an existing record.

How can I do this?

Thanx

Ekta
 
Code:
Private Sub cboBox_AfterUpdate()

    If Me.cboBox = "Active" Then
            MsgBox "Active"
        ElseIf Me.cboBox = "Pending" Then
            MsgBox "Pending"
        ElseIf Me.cboBox = "Retired" Then
                MsgBox "Retired"
        ElseIf Me.cboBox = "Lost" Then
                MsgBox "Lost"
    End If
   
End Sub

That's a VERY simple way, that should suit you just fine.
________
FORD ORION HISTORY
 
Last edited:
Thanks for replying a.sinatra. It is close to what I want. It shows the message box even when a user adds a new record. I want to see it only when they change the value in an existing record.

-Ekta
 
If Me.NewRecord Then
Else
If If Me.cboBox = "Active" Then
MsgBox "Active"
etc
 
a.sinatra said:
That's a VERY simple way, that should suit you just fine.

Na: Select Case ;)

Code:
Private Sub cboBox_AfterUpdate()

    Select Case Me.cboBox
        Case Is = "Active" 
            MsgBox "Active"
        Case Is = "Pending"
            MsgBox "Pending"
        Case Is = "Retired"
            MsgBox "Retired"
        Case Is = "Lost" Then
            MsgBox "Lost"
        Case Else
            MsgBox "Unknown Selection"
    End Select
   
End Sub
 
ekta said:
It is close to what I want. It shows the message box even when a user adds a new record. I want to see it only when they change the value in an existing record.

Code:
If Not Me.NewRecord Then
    If Me.cboBox = "Active" Then MsgBox Me.cboBox
End If
 
Mile-O-Phile said:


Na: Select Case ;)

Code:
Private Sub cboBox_AfterUpdate()

    Select Case Me.cboBox
        Case Is = "Active" 
            MsgBox "Active"
        Case Is = "Pending"
            MsgBox "Pending"
        Case Is = "Retired"
            MsgBox "Retired"
        Case Is = "Lost" Then
            MsgBox "Lost"
        Case Else
            MsgBox "Unknown Selection"
    End Select
   
End Sub

Damn. I got last place :p
Learn something new everyday, i though select case could only call numbers :mad: (my stupid oracle teacher)
________
LAMBORGHINI JARAMA HISTORY
 
Last edited:
The thing is:

Code:
Private Sub cboBox_AfterUpdate()

    Select Case Me.cboBox
        Case Is = "Active" 
            MsgBox "Active"
        Case Is = "Pending"
            MsgBox "Pending"
        Case Is = "Retired"
            MsgBox "Retired"
        Case Is = "Lost" Then
            MsgBox "Lost"
        Case Else
            MsgBox "Unknown Selection"
    End Select
   
End Sub

can easily shortened to:

Code:
Private Sub cboBox_AfterUpdate()

    If IsNull(Me.cboBox) Then
        MsgBox "Unknown Selection"
    Else
        MsgBox Me.cboBox
    End If
   
End Sub
 

Users who are viewing this thread

Back
Top Bottom