I thought I had it figured out yesterday. WRONG! I have 2 combo boxes, CBUnit and CBSub. When value is clicked within CBUnit, it should bring up corresponding sub-values in CBSub. These combo boxes are based on 2 tables; tbl_Unit and tbl_Sub.
CBUnit has the following:
RowSource: tbl_Unit
ColumnCount: 2
ColumnWidth: 0";1.5"
BoundColumn: 1
CBSub has the following:
RowSource: SELECT tbl_Sub.AUTONUM BER, tbl_Sub.Sub FROM tbl_Sub ORDER BY [Sub];
ColumnCount: 2
ColumnWidth: 0";1"
BoundColumn: 1
In theVisual Basic Editor, I put the following code:
I put nothing in CBSub.
Well, the values show in Unit once I return to datasheet view. However, when I click on a value, it comes up with the following error:
"Run-time error '2465':
Microsoft Office Access can't find the field 'Sub' referred to in your expression"
For the life of me I cannot figure out how it can't find it! Can someone please help me???
CBUnit has the following:
RowSource: tbl_Unit
ColumnCount: 2
ColumnWidth: 0";1.5"
BoundColumn: 1
CBSub has the following:
RowSource: SELECT tbl_Sub.AUTONUM BER, tbl_Sub.Sub FROM tbl_Sub ORDER BY [Sub];
ColumnCount: 2
ColumnWidth: 0";1"
BoundColumn: 1
In theVisual Basic Editor, I put the following code:
Code:
Private Sub CBUnit_AfterUpdate() With Me![Sub] If IsNull(Me!Unit) Then .RowSource = "" Else .RowSource = "SELECT [Sub] " & _ "FROM tbl_Sub " & _ "WHERE [UnitID]=" & Me!Unit End If Call .Requery End With End Sub
Well, the values show in Unit once I return to datasheet view. However, when I click on a value, it comes up with the following error:
"Run-time error '2465':
Microsoft Office Access can't find the field 'Sub' referred to in your expression"
For the life of me I cannot figure out how it can't find it! Can someone please help me???
Comment