473,657 Members | 2,516 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help with basing one combo box on another in a subform

4 New Member
I am having trouble basing a combo box in a subform that gives selected data from the mainform combo box. Basically combo box1 gives a restricted data set to combo box2.

Here is an small sample of the data, the data comes from two lists.

Table:Facilitie s -
FacilityID ... FacilityType
1 ............ Bus
2 ............ Library

Table: Additional
DetailID .... Details .......... FacilityType
1 ..............T Imetable .......... Bus
2 ............... Sheltered ......... Bus
3 .............. Opening hours .... Library
4 ............. Borrowing ........... Library

The form is saved in a third table called "Saved"
Table: Saved
SavedID .... FacilityID .... DetailID

But this is a single form. I have this working, but I cannot add descritive data for the 'Details' set. I need to make it a subform and have an extra descriptive column to key in the data for the 'details'. I haved looked into the multi-subform solution, but this just makes me have too many tables and too many forms, I like to keep the data in a single table and a single form.
Nov 23 '06 #1
2 2346
NeoPa
32,568 Recognized Expert Moderator MVP
In your Additional table you need the FacilityID rather than the FacilityType.
I can't see any reason why you'd want a Saved table.
A SELECT query will happily return the data you want, JOINing the tables if necessary.
If the ComboBox is on the same form then simply refer to it by name.
If on the subform or parent form, then I only know it's less straightforward .

I suggest you give your design a bit of a rethink though. The whole job may work out simpler if you work with the system ;).
Nov 23 '06 #2
docsix
4 New Member
In your Additional table you need the FacilityID rather than the FacilityType.
I can't see any reason why you'd want a Saved table.
A SELECT query will happily return the data you want, JOINing the tables if necessary.
If the ComboBox is on the same form then simply refer to it by name.
If on the subform or parent form, then I only know it's less straightforward .

I suggest you give your design a bit of a rethink though. The whole job may work out simpler if you work with the system ;).
You were right about the naming of the column. The Saved table is there to record the changed made from the combo boxes. The main form will also contain at least another 10 more fileds.

Currently all I have is a single form with two combo boxes. Combo box 1 is the facilities and combo box 2 is details. I like to move combo box 2 into a subform and add a second set a data which is keyed in by the user.

When I put combo box 2 into a subform, the populating of that box dosent work. The row source definition that I use on the single form is:

SELECT Additional.Deta ilID, Additional.Deta ils, Additional.Faci lityID FROM Additional WHERE (((Additional.F acilityID)=Form s!Saved!Facilit y)) ORDER BY Additional.Deta ils;

Also combo box 1 has an after update event

Option Compare Database

Private Sub Facility_AfterU pdate()
Details = Null
Details.Requery
Details = Me.Details.Item Data(0)
End Sub

Private Sub Form_Current()
Details.Requery
End Sub

Private Sub Form_Load()
If IsNull(Facility ) Then
Facility = Me.Facility.Ite mData(0)
Call Facility_AfterU pdate
End If
End Sub

What do I need to do to make this work in a subform
Nov 24 '06 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
1899
by: Jeremiah J. Burton | last post by:
I am trying to create a database (in Acces 2000) to track my fossil collection. I have a main table that has records for every specemen. I have a secondary table with information on localities that the specimens were collected at. The tables are linked. Each record in the specimen table will link to only 1 record in the locality table, however each locality can be linked to multiple specimens. I am trying to create a form (based on...
3
3605
by: Paul T. Rong | last post by:
I have a listbox (of product names) control on my form. I want to pass the selected item (a product name) to a subform, and the product unitprice should apear automatically next to the product name in the subform. Is it possible? How do I do this? Thanks in advance. Paul from Slovakia
1
2965
by: BigJay | last post by:
I am 1. trying to have a combobox used as a selector to display records in a subform. and not sure on how to get selected info into subform.the combo is populated but can not get subform updated when selection is made..... 2. I also want to use one combo box to select a second set of criteria in a second combo box that is then used to refine displayrd records in a a subform.... am afraid im lost on this..??? I have a main table that...
14
3095
by: alwayshouston | last post by:
Hi All! I am working on this very small database and I am confused in the designing a simple form. I only have three tables in the database. First Table: tblExpense Columns: ExpenseID ; ExpenseType Data: 1 ; FOOD 2 ; AIRLINE 3 ; FARE
0
1543
by: CalMyPal | last post by:
Basing one combo box on another January 31, 2005 By Sal Ricciardi Making choices is what a combo box is for, but sometimes one choice depends on another. In this installment, you'll learn how to set up one combo box so that its list is based on the selection you make in another. We provide an example in a sample database that you can download. When I add the close statement to his code it keeps asking for the combo box parameters. ...
2
1902
by: docsix | last post by:
I am having trouble populating a combo box in a subform. Currently I have two combo boxes on a single form that works. This is my current setup: Table:Facilities - FacilityID ... FacilityType 1 ............ Bus 2 ............ Library Table: Additional DetailID .... Details .............. FacilityID 1 ..............TImetable .......... Bus
3
2896
by: Phil | last post by:
I've posted this a few times without any luck, hoping for some fresh ideas on this. I'm pretty certain this can be done. I've been using a micrsoft template to create a supplier database called the Inventory management database, I have changed this so that there is a link in the relationships with the suppliers so that every product entered has a specific supplier related, thats fine the main problem I've encountered is setting up the...
3
1549
by: Strasser | last post by:
In a nested subform in datasheet view, an interviewer of homeless people picks a descriptive CATEGORY from 20 descriptive categories. The 20 categories are displayed via a combo box. (Categories are things like "addiction", "criminal", "dangerous?" etc. Total number of categories = 20). For EACH of the 20 categories there are 5 statuses, from "bad" (1=worst) to "good" (5=best). (Therefore, there are really 100 choices: 20 categories...
5
4897
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 the State chosen by only showing cities in that selected state. 4. When I open just the subform it works just fine but when I open the
0
8324
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8842
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8740
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8516
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8617
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
4173
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4330
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1970
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1733
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.