What you can do is store the faultid in the itemdata of the first listbox. Then you can fill the second list box with all of the records which have that same fault id.
The code would look something like this:
Code:
Sub Form_Load()
dim rs as New Recordset
csql = "SELECT * FROM TABLE2"
rs.open csql,Conn
list1.clear
if rs.eof = false then
while rs.eof = false
list1.additem rs.fields("stopreason")
list1.itemdata(list1.newindex) = rs.fields("faultid")
rs.movenext
wend
end if
End Sub
Sub List1_Click()
dim rs as new Recordset
if list1.listindex <> -1 then
csql = "SELECT * FROM TABLE1 WHERE faultid=" & list1.itemdata(list1.listindex)
rs.open csql,Conn
list2.clear
if rs.eof = false then
while rs.eof = false
list2.additem rs.fields("faultcause")
rs.movenext
wend
end if
end if
End Sub
Hope this helps
[Edited by Negative0 on 08-14-2000 at 02:41 PM]