Find record/s in a subform

S

stealth

I need to be able to find records by searching the Subject Keyword field
(in a subform).

I need an option which a non-Access user can manage without too much
instruction. The instruction will need to be on the form.

Thanks

Melbourne, VIC
 
A

Allen Browne

If this is the typical setup where the main form contains records and the
subform has only the matching records, it is not just a matter of applying a
filter to the subform. What you need to do is to filter the main form so it
contains only those records that have a match in the subform.

If that's what you are trying to do, see:
Filter a Form on a Field in a Subform
at:
http://allenbrowne.com/ser-28.html

If the subform has nothing in its LinkMasterFields/LinkChildFields
properties, then it is just a matter of applying a filter. You could put an
unbound text box on your form, and use its After Update event procedure to
filter the subform:

Private Sub txtFindThis_AfterUpdate()
With Me.[NameOfYourSubformControlHere].Form
If .Dirty Then
.Dirty = False
End If
If IsNull(Me.txtFindThis) Then
.FilterOn = False 'Nothing entered: show all records.
Else
.Filter = "[Subject Keyword] Like ""*" & Me.txtFindThis & "*""
.FilterOn = True
End If
End With
End Sub
 
S

stealth

I read an earlier post about using filters and I couldn't get it to
work.

The main form also has fields that my users will want to search: eg
title, author, journal details etc

The subform is connected to a query of TitleID & SubjectID, and which
is related to a table of subject keywords. As I catalogue a
book/journal I search the table and select appropriate subject
keywords. So that one book/journal article etc may have 1 or more
subject keywords attached to it.

The users of the database may want to search for titles based on a
keyword.

Does that provide enough information to ascertain whether filters is
the way I need to go?

thank you
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top