Wrox Programmer Forums
|
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 August 8th, 2012, 12:36 PM
Registered User
 
Join Date: Apr 2009
Posts: 7
Thanks: 3
Thanked 0 Times in 0 Posts
Default subform combobox problem

Hi - I've been tearing my hair out with this, so I hope someone can help.

I have an access 2007 mdb front end which links to a sql 2008 server instance.

I have created a main form which holds data pertaining to cases, on this there is a continous subform holding information about people and is incorporating two tables, table people and table contact info. the info on people includes ethnicity info which is spread over three combo boxes, main category, subcategory and other. these comboboxes are fed from three different tables, however, the choices in the subcategory combo box are dependent on what was chosen in the main category. so, in the after update event of the main category I put a me.subcategorycombobox.requery event. the sub category combobox is sourced by by a "select all where maincategoryID is like [forms]![subform]![maincategorycombobox]".

Now this all works fine when I open the subform on it's own, however, when opening the main form with the subform on it, the comboboxes cannot display correct data and throw me a parameter request instead. none of the requerying seems to be happening either. I have no idea what the problem is, so would really appreciate any help. Thank you. B
 
Old August 8th, 2012, 01:01 PM
Authorized User
 
Join Date: Oct 2010
Posts: 64
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Hi,

This is because "subform" is no longer in the Forms collection, but the "mainform" is.

You can change the SQL to use
[Forms]![mainform_name]![subform_control]!maincategorycombobox].

Alternatively, you could update the subcategorycombobox's rowsource property with the actual value of the main category in the AfterUpdate event of the maincategorycombobox .

HTH.

Malc.
The Following User Says Thank You to malcolmdixon For This Useful Post:
BabaYaga (August 8th, 2012)
 
Old August 8th, 2012, 01:16 PM
Registered User
 
Join Date: Apr 2009
Posts: 7
Thanks: 3
Thanked 0 Times in 0 Posts
Default

darn! of course! named it properly and it solved the problem. Thank you. B





Similar Threads
Thread Thread Starter Forum Replies Last Post
Subform problem fatrich Access VBA 6 October 4th, 2007 08:02 PM
Filling SubForm from ComboBox ayazhoda Access VBA 4 June 5th, 2007 10:56 AM
Print subform problem J.K.W.Y. Access 4 April 25th, 2006 06:21 AM
Ids problem on subform ailyn Access VBA 1 December 9th, 2005 05:30 PM
Access SubForm Problem jscully Access 9 August 29th, 2005 03:03 PM





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