Unbound Form/Controls w/ 1 Cmbox displaying 2 lstboxes data

J

Jebuz

Hi all,

I am working on a form and have it almost working how I want. I have a main
form that is unbound with 3 main controls. A combo box and 2 list boxes, all
unbound but just using queries from tables. My database consists of a list
of "sites" that each has 0 to many "monitors" at them of which each monitor
can have 0 to many "sensors" attached to it. So the hierarchy is
Sites->Monitors->Sensors. Now the question.

I'd like a user to select in the combo box 1 Site. Then display all the
data about the monitors and sensors connected to those monitors at that
particular site. I tried subforms and it works the user can't tell which
sensors go to which monitor, because it just displays all of them at once.
(ie 2 monitors listed with 8 sensors (4 per monitor)). I want to be able to
select the site, then select a monitor in the listbox just populated from the
combo box selection and have that populate the sensors listbox with sensors
connected to that monitor. Although this doesn't work perfectly how I have
it with queries on unbound controls etc. After selecting the combobox it
only refreshed the monitors (not sensors, cuz it doesn't know what monitor to
use to refresh). Also if I select the monitor next it refreshes the sensors
but then if I select a new site the sensors don't clear like they should
(since it's a brand new site).

Anyone have any clue how to accomplish such a view?? Seems like I get about
70% of my solution working in either subforms or unbound forms but can't get
the other 30% working in either design.

Thanks in advance and sorry for the lengthy post.
 
S

SteveS

I did something similar a long time ago. I had 7 cascading listboxes:

Unit->Area->Facility->Process->Equipt->Tag->Component

For the listboxes, I used the click event. On another form, I had to use
combo boxes due to space limitations (busy form). In the combo boxes, I used
the after update event.

I won't post the code for all listboxes........ just the code for the first
two listboxes:
(lst = ListBox)

Private Sub lstUnit_Click()

'--clear selections--

lstArea = Null
lstFacility = Null
lstProcess = Null
lstCategories = Null
lstTag = Null
lstEquipt = Null

'-----------------------
'for debugging
'clear unbound text box
ubFacType = Null
'-----------------------

'--requery to clear the list items--

lstArea.Requery
lstFacility.Requery
lstProcess.Requery
lstEquipt.Requery
lstCategories.Requery
lstTag.Requery

'-----------------------
'for debugging/the following
'displays the PK of each listbox
'selected item
' (Multiselect set to None)

'--clear the textboxes--
Text12 = ListUnit
Text10 = Null
Text14 = Null
Text24 = Null
Text26 = Null
'-----------------------
End Sub


Private Sub lstArea_Click()
'--clear selections--
lstFacility = Null
lstProcess = Null
lstEquipt = Null
lstCategories = Null
lstTag = Null

'-----------------------
'for debugging
ubFacType = Null
'-----------------------

'--requery to clear the list items--

lstFacility.Requery
lstProcess.Requery
lstEquipt.Requery
lstCategories.Requery
lstTag.Requery

'-----------------------
'--clear textboxes--
Text10 = ListArea
Text14 = Null
Text24 = Null
Text26 = Null
'-----------------------
End Sub



This should give you an idea of what you should do......
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top