G
Guest
Hello All,
I am tring to create cascading list boxes where the criteria in the second
list box depends on the selection from the first list box. Here is some
general info and my code. Any help would be appreciated.
1st list box = lboPrimaryOcc
2nd list box = lboSecondOcc
Table 1:
Table Name - tblPrimOccurrence
Pimary Key - numPrimOccPK
Field Name - strPrimOccLabel
Table 2:
Table Name - tblSecOccurrence
Pimary Key - numSecOccPK
Field Name - strSecOccLabel
The first list box (lboPrimaryOcc) has a row source of "tblPrimOccurrence".
The second list box (lboSecondOcc) does not have a record source.
I have coded the after update event of the first list box (lboPrimaryOcc) as
follows:
Dim strSQL As String
strSQL = "SELECT lboPrimaryOcc "
strSQL = strSQL & " FROM tblPrimOccurrence "
strSQL = strSQL & "WHERE numPrimOccPK = " & Me!lboPrimaryOcc
Me.lboSecondOcc.RowSourceType = "Table/Query"
Me.lboSecondOcc.RowSource = strSQL
I have no otrher code anywhere else. Can someone let me know where I'm
going wrong.
Regards,
George
I am tring to create cascading list boxes where the criteria in the second
list box depends on the selection from the first list box. Here is some
general info and my code. Any help would be appreciated.
1st list box = lboPrimaryOcc
2nd list box = lboSecondOcc
Table 1:
Table Name - tblPrimOccurrence
Pimary Key - numPrimOccPK
Field Name - strPrimOccLabel
Table 2:
Table Name - tblSecOccurrence
Pimary Key - numSecOccPK
Field Name - strSecOccLabel
The first list box (lboPrimaryOcc) has a row source of "tblPrimOccurrence".
The second list box (lboSecondOcc) does not have a record source.
I have coded the after update event of the first list box (lboPrimaryOcc) as
follows:
Dim strSQL As String
strSQL = "SELECT lboPrimaryOcc "
strSQL = strSQL & " FROM tblPrimOccurrence "
strSQL = strSQL & "WHERE numPrimOccPK = " & Me!lboPrimaryOcc
Me.lboSecondOcc.RowSourceType = "Table/Query"
Me.lboSecondOcc.RowSource = strSQL
I have no otrher code anywhere else. Can someone let me know where I'm
going wrong.
Regards,
George