Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
| Search | Today's Posts | Mark Forums Read
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 December 30th, 2005, 12:00 PM
Registered User
Join Date: Dec 2005
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Query based on combo box selection help

I have a form with three subforms, and I'm having problem with one of them. The link between subforms and forms are store number, which is stored in a combo box. Idealy, after a user pick a store from the combo box, the subform would update itself. Two out of the three subforms are based on two crosstab queries and they work perfectly fine. The last subform is a select query, and it seems like it's not rerunning itself after updating the combo box. The query is very simple, it just has store number, description, and grouped by amount. I tried with no criteria in the store field and run the masterform,seems like all it's doing is showing value for the first store in the table, and never changes afterwards, I also tried entering "forms!frmStores!cmbStore" in the criteria for the store, then the subform came out empty, it seems like it's only reading combo box's default value null. I have a line of code for the mater form frmStores as "me.[DisplaySubform].requery" for all three subforms, but it seems like it's working for the first two and not the select query. Anybody can help me with this? oh, the combo box is unbounded, because i do not want my table to be updated by selection. Please help. Thank you!

Old January 3rd, 2006, 11:33 PM
Registered User
Join Date: Jan 2006
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts

Not sure if this is will do the trick but it works for me with one subform. On the combo box I have 2 event procedures (maybe there's a way to do it all as one??) the first is triggered on After Update the other is Not In List.

Private Sub cboSearchByStoreID_AfterUpdate()

On Error GoTo Err_cboSearchByStoreID_AfterUpdate

    Dim rst As DAO.Recordset
    Set rst = Me.RecordsetClone

        rst.FindFirst "[StoreID] = " & Str(Me![cboSearchByStoreID])
        Me.Bookmark = rst.Bookmark
        Me![cboSearchByStoreID] = Null

    Exit Sub

    Resume Exit_cboSearchByStoreID_AfterUpdate

End Sub

Private Sub cboSearchByStoreId_NotInList(NewData As String, Response As Integer)

MsgTitle = "Store ID Not Found"
NewEntry = MsgBox("The store ID you selected was not found.", MsgDialog, MsgTitle)

End Sub

Good luck!!

Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic selection of next page based on list box s gurupot JSP Basics 1 December 24th, 2007 06:03 AM
add drop down / combo box for selection mamuco Classic ASP Components 0 May 30th, 2007 06:34 PM
Combo Box -1 Selection Little Shell VB.NET 2002/2003 Basics 5 June 14th, 2005 06:16 PM
Combo box doesnot accept the selection shoakat Classic ASP Databases 2 August 13th, 2004 06:19 PM
Populate List Box by Combo Box Selection mmcdonal Access 2 June 15th, 2004 12:08 PM

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