Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2011
    Posts
    48

    Unanswered: Must Chose an option form a combo box

    So this is a follow up question from my other one that Missinglinq was able to help me out with. Is there a way in a form to make a user choose an option from the combo box, so that it can't be left blank? The code below works for the text box, I just can't figure out how to modify it to make it work for combo box.

    Private Sub Form_BeforeUpdate(Cancel As Integer)
    If Nz(Me.Control1,"") = "" Then
    MsgBox "Control1 Must Not Be Left Blank!"
    Cancel = True
    Control1.SetFocus
    Exit Sub
    End If

    If Nz(Me.Control2, "") = "" Then
    MsgBox "Control2 Must Not Be Left Blank!"
    Cancel = True
    Control2.SetFocus
    Exit Sub
    End If

    End Sub

    thanks!

  2. #2
    Join Date
    Mar 2009
    Location
    Dorset
    Posts
    119
    What can't you figure out i.e. what is or is not happening?
    I assume that control2 is the name of your combobox?
    Regards
    JD

    Software-Matters

  3. #3
    Join Date
    Sep 2011
    Posts
    48
    Quote Originally Posted by SoftwareMatters View Post
    What can't you figure out i.e. what is or is not happening?
    I assume that control2 is the name of your combobox?
    Oops, I figured it out sorry for not posting before. Thanks though!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •