By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,164 Members | 1,019 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,164 IT Pros & Developers. It's quick & easy.

Combo Box in subform help needed

P: 4
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
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

The saved table takes the combo box inputs. Table:Facility and Table:Additional are linked via FacilityID column. Basically if I click on Bus in combo box 1 it populates combo box 2 with Timetable and Sheltered, which I then choose one of them.

This is done with an after update event in combo box 1:

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

Combo box 2 has the selection code:

SELECT Additional.DetailID, Additional.Details, Additional.FacilityID FROM Additional WHERE (((Additional.FacilityID)=Forms!Saved!Facility)) ORDER BY Additional.Details;

What I would like to do is move combo box 2 into a subform and add another field to describe what the details mean. I don't know what coding chages I have to make or even if I need another table to store the new information.
Nov 26 '06 #1
Share this Question
Share on Google+
2 Replies


PEB
Expert 100+
P: 1,418
PEB
Simply you need to change the references to the field Details including the path like:

MyForm!Control.Form![Detail]
Nov 27 '06 #2

P: 4
Anyone have an idea or a downloadable example of how to fix this problem?
Dec 9 '06 #3

Post your reply

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