Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 20th, 2005, 05:09 PM
Registered User
 
Join Date: Jan 2005
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Dynamic Filter Form, need tip

In my question there are 3 objects to be considered.
1. "FormA" which contains combo boxes in which the user makes selections in order to filter data in "SubformA"
2. "SubformA" which appears on the bottom of "FormA" in a datasheet view.
3. "QueryA" which provides the data for "SubformA" using the criteria provided in "FormA"

My problem is applying the filter. I have been toying with ReQuery and refresh commands and cannot get this form to work properly. Essentially "AfterUpdate" of each combo box, I want the query that powers the subform to rerun as well as the subform to refresh. Can anyone help me? I appreciate any help!
Thanks,
Justin

 
Old January 24th, 2005, 11:08 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,093
Thanks: 1
Thanked 12 Times in 11 Posts
Default

Hi Justin,

You should be able to simply set the subform's record source property in code based on combo box criteria, like:

On Error GoTo cboSelect_AfterUpdate_ERR

    Dim strSQL As String
    Dim strCriteria As String

    strCriteria = "FieldID = '" & cboSelect & "'"

    strSQL = "SELECT * " & _
                "FROM qSel_Data " & _
                "WHERE " & strCriteria

    ' Set sub form's recordsource and requery
    fsubSubForm.Form.RecordSource = strSQL
    fsubSubForm.Requery

End Sub

HTH,

Bob

 
Old January 24th, 2005, 12:37 PM
Registered User
 
Join Date: Jan 2005
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Bob,

Thanks again for all your help. You have really helped me finish this project. I can't thank you enough.

-Justin

 
Old January 24th, 2005, 12:54 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,093
Thanks: 1
Thanked 12 Times in 11 Posts
Default

My pleasure Justin. Glad its working for you :).

Bob






Similar Threads
Thread Thread Starter Forum Replies Last Post
How to use Dynamic Filter on ObjectDataSource onlinedev ASP.NET 2.0 Basics 0 December 5th, 2007 03:21 PM
help writing dynamic form data to dynamic table ublend SQL Server ASP 1 June 1st, 2007 08:09 AM
help writing dynamic form data to dynamic table ublend Classic ASP Professional 1 June 1st, 2007 08:08 AM
Dynamic Pivot Table Filter?? tready Excel VBA 1 February 21st, 2006 01:27 AM
how to parse filter from a form to a main form flyfish Access 1 February 1st, 2005 05:36 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.