Search Combobox for String when Button Clicked

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mcupito
    Contributor
    • Aug 2013
    • 294

    Search Combobox for String when Button Clicked

    I've a Combobox in a subform that will contain values. While entering data on the subform, a value of '?????' is acceptable, however when the 'Submit' button is clicked on the main form, I wish to present MsgBox("Must enter correct info") and make them choose the correct value in the combobox.

    I know this can be done in VBA, however I am not sure exactly how to do it.

    My best guess was (on click, event procedure) :
    If Me.MainForm.Sub Form.ComboBox.T ext = "?????" Then
    MsgBox("Must Enter Correct Information")
    End If

    But it isn't working.

    Thanks.
  • Seth Schrock
    Recognized Expert Specialist
    • Dec 2010
    • 2965

    #2
    To reference a control on a subform, you do it like this:
    Code:
    Me.[I]Main_Form_Name[/I].[I]Subform_name[/I].Form.[I]Control_Name[/I]
    See Referring to items on a subform for more details.

    Comment

    Working...