Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / May 2005

Tip: Looking for answers? Try searching our database.

Find record/s in a subform

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
stealth - 04 Jan 2004 06:21 GMT
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

------------------------------------------------
Allen Browne - 04 Jan 2004 09:02 GMT
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

Signature

Allen Browne - Microsoft MVP.  Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

> I need to be able to find records by searching the Subject Keyword field
> (in a subform).
[quoted text clipped - 5 lines]
>
> Melbourne, VIC
Diana Tan - 12 May 2005 05:49 GMT
Hi Allen,

I was currently doing something similar as stealth...
I has put the code in successfully... But any idea how do i add in more
criteria to filter the records?
and is there any way to prevent any editing of the records in the subform?
stealth - 06 Jan 2004 01:53 GMT
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

------------------------------------------------
Allen Browne - 06 Jan 2004 06:14 GMT
The article at:
   http://allenbrowne.com/ser-28.html
should be perfect for your needs.

Signature

Allen Browne - Microsoft MVP.  Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

> I read an earlier post about using filters and I couldn't get it to
> work.
[quoted text clipped - 13 lines]
> Does that provide enough information to ascertain whether filters is
> the way I need to go?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.