Minggu, 01 Februari 2015

Re: [MS_AccessPros] Help with issue on using subforms

 

Rod-


It sounds like you're wanting to display the same table in both subforms and selectively apply filters to the two subforms to see if you can find matches.  If that is the case, the outer form should have no Record Source.  You need unbound controls on the outer form where you can enter filter criteria, one for each subform.  You could then enter something like:

LastName = 'Smith'

To do multiple filters, you would need to add the AND keyword and the second filter:

LastName = 'Smith' AND FirstName LIKE 'J%'

.. in the filter box for one or either of the subforms.  In the AfterUpdate event of the filter text box, add code something like:

Private Sub txtFilter1_AfterUpdate()
    ' Attempt to apply what was entered as a filter to the first subform
    Me.Subform1.Form.Filter = Me.txtFilter1
    Me.Subform1.Form.FilterOn = True
End Sub

It would probably also be advisable to add two command buttons - one each to clear the filter you've attempted for each subform.

Private Sub cmdClearFilter1_Click()
    ' Remove the subform filter
    Me.Subform1.Form.FilterOn = False
    Me.Subform1.Form.Filter = ""
End Sub


John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications 
SQL Queries for Mere Mortals 
(Paris, France)




On Feb 2, 2015, at 4:23 AM, desertscroller@cox.net [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:

I have a form that has a data source to a table.  On the form are two subforms, each subform is to be a filtered revision of the main form.  I am trying to compare and correct data that may be duplicated in the main form.
Two users may enter data about the same taxpayer ( one using the tax id and the other using a dummy id).  What to display both records to allow the manage the opportunity to combine the records under the tax id.  In some cases the table may reference multiple data entries.  Examples would be taxpayer having multiple land parcels so all the parcels need to be compared and united as one record per parcel.
Probably to such info.  Having issue setting the filters for each subform.
Rod



__._,_.___

Posted by: John Viescas <johnv@msn.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (2)

.

__,_._,___

Tidak ada komentar:

Posting Komentar