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

Find a Record on my SUBForm using a Combo Box

Status
Not open for further replies.

vikin9

Technical User
Jun 22, 2001
16
0
0
US
I want to find a record on a bound SUBform using a combo box located on an unbound main form. I want to use a datasheet subform to display the records, so I need to put the combo box in the header of the main form.

I've tried modifying the combo box code from the wizard to refer to the subform, but can't make it work:

Sub Combo1_AfterUpdate()
' Find the record that matches the control.
Me.RecordsetClone.FindFirst "[txtPartNumber] = '" & Me![Combo1] & "'"
Me.Bookmark = Me.RecordsetClone.Bookmark
End Sub

Maybe there's another way. Any help would be appreciated. Thanks.

 
Try Something like this:
Private Sub Combo1_Change()


SearchString = "Select * FROM tbl_YourTable "
SearchString = SearchString & "Where [YourField] = '" & me.Combo1 &"'"

SearchString = "Select * FROM tbl_YourTable " & SearchString
Forms![frm_MAIN_FORM]![frm_SUB_FORM].Form.RecordSource = SearchString

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top