Can someone help me by adding looping code for 3 cboDesc boxes, cboDesc1, cboDesc2, cboDesc3
Private Sub cboApplication_AfterUpdate()
Dim sSQL As String
'MsgBox "The Code is Executing!"
'clear cboDesc1
Me.cboDesc1 = Null
sSQL = "SELECT Desc1 FROM tblApplicationDescription"
sSQL = sSQL & " WHERE [Application] = '" & Me.[cboApplication] & "' "
sSQL = sSQL & " ORDER BY Desc1"
'for debugging
'Debug.Print sSQL
Me.cboDesc1.RowSource = sSQL
'check if txtDesc1 has values
If IsNull(Me.cboDesc1.ItemData(0)) Then
Me.cboDesc1.Enabled = False
Else
Me.cboDesc1.Enabled = True
Me.cboDesc1 = Me.cboDesc1.ItemData(0)
'optional
Me.cboDesc1.SetFocus
Me.cboDesc1.Dropdown
End If
End Sub
Private Sub cboApplication_AfterUpdate()
Dim sSQL As String
'MsgBox "The Code is Executing!"
'clear cboDesc1
Me.cboDesc1 = Null
sSQL = "SELECT Desc1 FROM tblApplicationDescription"
sSQL = sSQL & " WHERE [Application] = '" & Me.[cboApplication] & "' "
sSQL = sSQL & " ORDER BY Desc1"
'for debugging
'Debug.Print sSQL
Me.cboDesc1.RowSource = sSQL
'check if txtDesc1 has values
If IsNull(Me.cboDesc1.ItemData(0)) Then
Me.cboDesc1.Enabled = False
Else
Me.cboDesc1.Enabled = True
Me.cboDesc1 = Me.cboDesc1.ItemData(0)
'optional
Me.cboDesc1.SetFocus
Me.cboDesc1.Dropdown
End If
End Sub