473,505 Members | 15,626 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:Facilities -
FacilityID ... FacilityType
1 ............ Bus
2 ............ Library

Table: Additional
DetailID .... Details .......... FacilityType
1 ..............TImetable .......... 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 2340
NeoPa
32,557 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.DetailID, Additional.Details, Additional.FacilityID FROM Additional WHERE (((Additional.FacilityID)=Forms!Saved!Facility)) ORDER BY Additional.Details;

Also combo box 1 has an after update event

Option Compare Database

Private Sub Facility_AfterUpdate()
Details = Null
Details.Requery
Details = Me.Details.ItemData(0)
End Sub

Private Sub Form_Current()
Details.Requery
End Sub

Private Sub Form_Load()
If IsNull(Facility) Then
Facility = Me.Facility.ItemData(0)
Call Facility_AfterUpdate
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
1885
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...
3
3589
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...
1
2955
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...
14
3082
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 ;...
0
1534
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...
2
1897
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...
3
2883
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...
3
1541
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...
5
4882
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...
0
7216
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7098
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...
1
7018
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...
0
7471
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...
0
5613
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4699
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3187
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...
0
3176
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1528
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.