Filtering SUBFORM

A

amsuria

Hi,

Good day!

I have a form that will search for records in my subform.

I have a textbox in my CUSTOMER form where users can type-in any strings.
Once the SEARCH command button is clicked, it will search all records in my
SUBFORM that has similar (LIKE) strings encoded in the textbox.

I know how to filter records in a form, but searching records in a SUBFORM
is now a different thing for me...

Any help will be appreciated...


Thank you


Amsuria

I can
 
D

dragos

Hello Amsuria,

Doing searches in a subform is the same thing that you normally do for
forms. You just have to made proper refferences.
Example: (place this code on the AfterUpdate event on your control
(named MyControl - located on the main form) where the users must enter
search string)

Me.RecordsetClone.FindFirst "[FieldName] = '" & MyControl & "'"
Me.Bookmark = Me.RecordsetClone.Bookmark
MyVar = MyControl.Value
Forms![Main Form]![Child Form].SetFocus
Me.Refresh
Forms![Main Form]![Child Form]![Control on the child form].SetFocus
DoCmd.FindRecord MyVar, , , , , acAll, True

Off course you can do a LIKE search easily.

Marry Christmas!
 
Top