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 May 18th, 2005, 08:31 AM
Registered User
 
Join Date: Apr 2005
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default Basing one combo on another - filter problem

I have created a form with two combo fields.

When you make a selection from the first field, the drop down list in the second field is limited by a query based on the first combo selection. The second combo queries like:

SELECT TblGrant.GrantID, TblGrant.GrantTypeID, TblGrant.GrantSubType FROM TblGrant WHERE (((TblGrant.GrantTypeID)=Forms!FrmWorkPlan!GrantTy pe));

and GrantType is the pick in the first combo.

I have also coded:

Private Sub GrantType_AfterUpdate()
    Me.GrantSubType = Null
    Me.GrantSubType.Requery
    Me.GrantSubType = Me.GrantSubType.ItemData(0)
End Sub

Private Sub Form_Current()
    Me.GrantSubType.Requery
    Me.ProjectName.Requery

End Sub

All works well except when I try to filter by form. The first combo works as expected but the second combo does not requery.

I have looked at several examples in the MicroSoft library - none of them will update the second combobox in filter by form either. I do not know how to force the second combo to requery in the filter by form situation.

Perhaps one of you has some thoughts on this topic??



 
Old May 21st, 2005, 10:47 AM
Friend of Wrox
 
Join Date: Nov 2004
Posts: 248
Thanks: 0
Thanked 1 Time in 1 Post
Default

I wonder if it does not requery only for specific records. I.e. Perhaps the record you have filtered to has a value for GrantSubType that isn't valid based on the GrantType and therefore the Select for the second combo doesn't allow a value to display for GrantSubType. Make sure that the code doesn't work at all when you're filtering. Make sure that the GrantSubType is valid in combination with the GrantType. Also make sure that your filter by form doesn't specify a filter with an invalid GrantType/GrantSubType combination. That could be restricting the display.

Randall J Weers
Membership Vice President
Pacific NorthWest Access Developers Group
http://www.pnwadg.org





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to apply filter to shrink combo box records beetle_jaipur Access 3 July 28th, 2007 01:58 AM
Subform Filter based on Multiselect Combo boxes natwong Access 2 November 16th, 2006 10:05 AM
Subform Filter using Multiple Combo boxes natwong BOOK: Expert One-on-One Access Application Development 0 November 13th, 2006 03:07 PM
Filter records using a combo box tixe83 Access 2 August 3rd, 2006 12:43 PM
Filter by Combo Boxes Corey Access VBA 5 June 1st, 2006 07:33 PM





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