472,800 Members | 3,567 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,800 software developers and data experts.

Cascading Combo Boxes on Subform within Tab Control - Help!

I hope that someone can offer a little advice on this one - I've
searched the group but can't find an answer. I think that I'm doing
something really stupid or missing something trivial, but see what you
can make of this...

I have a main form "Events" that contains a tab control. The tab
control has 7 pages. The 7th page (named "Boats") contains a subform
called "BoatEventssubform". On this sub-form are two combo boxes,
named "SupplierCombo" (unbound) and "BoatNameCombo" (bound to
"BoatID", an Autonumber Primary key).

The purpose of this whole form is to set up different aspects of
organising sailing events for a sailing club. Specifically this part
of the form is associate boats to an event by selecting a supplier
(yacht charter company) from the "SupplierCombo" list and filtering
the list of craft in the "BoatNameCombo" list to show only the yachts
in that supplier's fleet. Both combo boxes display some additional
information in the pick list e.g. location of supplier, location of
yacht but only the supplier name and boat name when the entries are
selected.

SQL for the two combo boxes is as follows:
SupplierCombo:
SELECT Suppliers.SupplierID, Suppliers.SupplierName,
Suppliers.CollectionPostalCity
FROM Suppliers;

BoatNameCombo:
SELECT Boat.BoatID, Boat.BoatName, BoatType.BoatBrand,
BoatType.BoatModel, Boat.Location, BoatType.Berths,
BoatType.LayoutType
FROM BoatType INNER JOIN Boat ON BoatType.BoatTypeID = Boat.BoatTypeID
WHERE
(((Boat.SupplierID)=[Forms]![BoatEventssubform].[Form]![SupplierCombo]))
ORDER BY Boat.BoatName, Boat.Location;

I also use the following code in the "After Update" property of
"SupplierCombo" to update the list in "BoatNameCombo":
Private Sub SupplierCombo_AfterUpdate()
Me.BoatNameCombo.Requery
End Sub

The filtering works exactly as planned when I open the sub-form on
it's own, but when it is opened as designed within the main form, the
"Enter Parameter Value" box is displayed with the parameter
"Forms!BoatEventssubform.Form!SupplierCombo". For debug purposes,
I've put a text box onto the sub-form to display the value of
"SupplierID". I have noticed that when the parameter value input box
is shown, the text box hasn't yet been updated with the new value.

This behaviour leads me to think that I am not correctly referencing
the first combo box from the second, and that specifically I'm missing
something to do with the tab control on the main form.

I'd be grateful for any suggestions as this is now driving me mad!

Thanks in Advance, Mike
Jan 28 '06 #1
3 5223
Mike Jakes wrote:
[snip]
I have a main form "Events" that contains a tab control. The tab
control has 7 pages. The 7th page (named "Boats") contains a subform
called "BoatEventssubform". On this sub-form are two combo boxes,
named "SupplierCombo" (unbound) and "BoatNameCombo" (bound to
"BoatID", an Autonumber Primary key). SQL for the two combo boxes is as follows:
SupplierCombo:
SELECT Suppliers.SupplierID, Suppliers.SupplierName,
Suppliers.CollectionPostalCity
FROM Suppliers;

BoatNameCombo:
SELECT Boat.BoatID, Boat.BoatName, BoatType.BoatBrand,
BoatType.BoatModel, Boat.Location, BoatType.Berths,
BoatType.LayoutType
FROM BoatType INNER JOIN Boat ON BoatType.BoatTypeID = Boat.BoatTypeID
WHERE
(((Boat.SupplierID)=[Forms]![BoatEventssubform].[Form]![SupplierCombo]))
ORDER BY Boat.BoatName, Boat.Location; [snip] The filtering works exactly as planned when I open the sub-form on
it's own, but when it is opened as designed within the main form, the
"Enter Parameter Value" box is displayed with the parameter
"Forms!BoatEventssubform.Form!SupplierCombo". For debug purposes,
I've put a text box onto the sub-form to display the value of
"SupplierID". I have noticed that when the parameter value input box
is shown, the text box hasn't yet been updated with the new value.

This behaviour leads me to think that I am not correctly referencing
the first combo box from the second, and that specifically I'm missing
something to do with the tab control on the main form.

[snip]

It's not the TabControl. That doesn't affect how you reference form objects at
all. When referencing a control on a subform you have to "go through" the main
form. Your reference doesn't mention the main form. You need...

WHERE
(((Boat.SupplierID)=[Forms]![Events]![BoatEventssubform].[Form]![SupplierCombo]))
--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com
Jan 28 '06 #2
On Sat, 28 Jan 2006 22:34:55 GMT, "Rick Brandt"
<ri*********@hotmail.com> wrote:

[snip]
The filtering works exactly as planned when I open the sub-form on
it's own, but when it is opened as designed within the main form, the
"Enter Parameter Value" box is displayed with the parameter
"Forms!BoatEventssubform.Form!SupplierCombo"

[snip]

It's not the TabControl. That doesn't affect how you reference form objects at
all. When referencing a control on a subform you have to "go through" the main
form. Your reference doesn't mention the main form. You need...

WHERE
(((Boat.SupplierID)=[Forms]![Events]![BoatEventssubform].[Form]![SupplierCombo]))
[snip]


Thanks for the quick response Rick - much appreciated

I tried your suggestion, but when running the main form "Events" I
again get the parameter prompt, this time for
"Forms!Events!BoatEventssubform.Form!SupplierCombo ".

I also now get the same prompt when running the sub-form
"BoatEventssubform" on it's own (which I think I understand -
basically the sub-form running in isolation doesn't require the
[Events] reference as in this mode it's not running as an embedded
control - of course, I could easily be misunderstanding the concept!).

Any other ideas, suggestions or divine inspiration would be more than
welcome!

Thanks again, Mike
Jan 29 '06 #3
Mike Jakes wrote:
Thanks for the quick response Rick - much appreciated

I tried your suggestion, but when running the main form "Events" I
again get the parameter prompt, this time for
"Forms!Events!BoatEventssubform.Form!SupplierCombo ".

I also now get the same prompt when running the sub-form
"BoatEventssubform" on it's own (which I think I understand -
basically the sub-form running in isolation doesn't require the
[Events] reference as in this mode it's not running as an embedded
control - of course, I could easily be misunderstanding the concept!).

Any other ideas, suggestions or divine inspiration would be more than
welcome!


First off there is no reference that will work in both circumstances. If
you need to use this form both as a subform and as a stand-alone form then
you need a different strategy. As for the reference when it is a subform
the correct generic syntax is definitely...

Forms!NameOfParentForm!NameOfSubformCONTROL.Form!N ameOf Control

Notice the ALL-CAPS portion. The syntax requires the name of the subform
*control* which is not necessarily the same as the form contained within
(often it is though). When in doubt I use the expression builder to navigate
to the control.
--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com



Jan 30 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Cameron | last post by:
Hi, For the database I am currently working on, my employer would like the ability to use multiple combo boxes in order to filter the database. For instance the structure of the company is based...
0
by: cognoscento | last post by:
I'm currently putting together a database for my work (not an expert by any stretch, so muddling through as best as I can... you know the story...) and I could use some advice and hand-holding ...
4
Rabbit
by: Rabbit | last post by:
Cascading Combo/List Boxes This tutorial is to guide you in the creation of Cascading combo/list boxes. That is when you have multiple combo/list boxes where the selection of an option in one...
6
by: Dave | last post by:
I want to put the information that the user selects in my combo boxes into a subform that lies on the same form as the combo boxes. Thanks for your help already, Dave
2
by: SPOILED36 | last post by:
I am building a database to track attendance. I have one main form with multiple subforms. Within one of the subforms name sfrDailyAttendance, I also have cascading combo boxes (cboCategory and...
5
by: samdev | last post by:
I have created two combo boxes in a subform.... For example 1. Combo Box State 2. Combo Box City 3. When a state from the Combo Box State is selected, the City combo box updates to reflect...
3
by: luciegiles | last post by:
I'd like to start off with an apology - I posted a question on a similar matter sometime ago and didn't respond to those who took the time to answer my question. At the time i gave up but have used...
20
by: luciegiles | last post by:
Hi, I have used the tutorial Cascading Combo/List Boxes to filter the combo box cboCareManager dependent on the entry to cboLocalityTeam - the common code between the two tables is LocalityCode. ...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.