J
Jeffrey Harris
I have the following tables setup..
Table: Computers
ComputerID - AutoNumber
ComputerName - Text
Table: Entries
EntryID - AutoNumber
ComputerID - Number
EntryText - Text
Computers.ComputerID has a one-to many relationship with Entries.ComputerID.
I've made a form with a record source of Computers. I've added a listbox
'lbxComputer' that I want populated with Computers.ComputerName. I've set
lbxComputer's row source field to 'select Computers.ComputerName,
Computers.ComputerID FROM Computers ORDER BY Computers.ComputerName;' which
seems to do what I want.
Now I want to populate a second listbox lbxEntries with Entries.EntryText
where Entries.ComputerID = lbxComputer.selectedItem.ComputerID. Initially
I've done this in the lbxComputer_Click subroutine with the following line
of code.. 'Me.lbxEntries = "select Entries.EntryText from Entries where
Entries.ComputerID=" & Me.Computer.Column(1)'
While this works, I can't help but feel like I'm doing this the hard way.
Is there an easier way to populate the 2nd listbox?
Table: Computers
ComputerID - AutoNumber
ComputerName - Text
Table: Entries
EntryID - AutoNumber
ComputerID - Number
EntryText - Text
Computers.ComputerID has a one-to many relationship with Entries.ComputerID.
I've made a form with a record source of Computers. I've added a listbox
'lbxComputer' that I want populated with Computers.ComputerName. I've set
lbxComputer's row source field to 'select Computers.ComputerName,
Computers.ComputerID FROM Computers ORDER BY Computers.ComputerName;' which
seems to do what I want.
Now I want to populate a second listbox lbxEntries with Entries.EntryText
where Entries.ComputerID = lbxComputer.selectedItem.ComputerID. Initially
I've done this in the lbxComputer_Click subroutine with the following line
of code.. 'Me.lbxEntries = "select Entries.EntryText from Entries where
Entries.ComputerID=" & Me.Computer.Column(1)'
While this works, I can't help but feel like I'm doing this the hard way.
Is there an easier way to populate the 2nd listbox?