I have develeped a select query that allows me to list in a secondary combo box only those items that are based from the first combo box. However, I need to have the secondary combo box be able to show it's entire list if the first combo box has nothing selected. I.E. IsNull
The following Select statements and vba program is what I am using.
First Combo Box - Select Statement from Source Properties
SELECT qryTypeList.TypeID, qryTypeList.Type FROM qryTypeList;
VBA is
Private Sub TypeFilter_AfterUpdate()
On Error GoTo Oops
Me.LkUpItm = Null
Me.LkUpItm.Requery
Me.LkUpItm = Me.LkUpItm.ItemData(0)
If IsNull(Me.TypeFilter) Then
Me.FilterOn = False
Else
Me.Filter = "Type = """ & Me.TypeFilter & """"
Me.FilterOn = True
End If
Get_Out:
Exit Sub
Oops:
MsgBox Err.Description
Resume Get_Out
End Sub
Secondary Combo Box Select Statement from Source Properties
SELECT qryItems.Item_ID, qryItems.Item, qryItems.Type FROM qryItems WHERE (((qryItems.Type)=Forms!InvtBal_frm!TypeFilter));
VBA is
Private Sub LkUpItm_AfterUpdate()
On Error GoTo Oops
Dim rs As DAO.Recordset
If Not IsNull(Me.LkUpItm) Then
If Me.Dirty Then
Me.Dirty = False
End If
Set rs = Me.RecordsetClone
rs.FindFirst "[Item]='" & Me![LkUpItm] & "'"
If rs.NoMatch Then
MsgBox [LkUpItm] & " Not Found"
Else
Me.Bookmark = rs.Bookmark
End If
Set rs = Nothing
[LkUpItm] = Null
End If
Get_Out:
Exit Sub
Oops:
MsgBox Err.Description
Resume Get_Out
End Sub
Thank you for your time and patience with any help on this matter
Robert M
The following Select statements and vba program is what I am using.
First Combo Box - Select Statement from Source Properties
SELECT qryTypeList.TypeID, qryTypeList.Type FROM qryTypeList;
VBA is
Private Sub TypeFilter_AfterUpdate()
On Error GoTo Oops
Me.LkUpItm = Null
Me.LkUpItm.Requery
Me.LkUpItm = Me.LkUpItm.ItemData(0)
If IsNull(Me.TypeFilter) Then
Me.FilterOn = False
Else
Me.Filter = "Type = """ & Me.TypeFilter & """"
Me.FilterOn = True
End If
Get_Out:
Exit Sub
Oops:
MsgBox Err.Description
Resume Get_Out
End Sub
Secondary Combo Box Select Statement from Source Properties
SELECT qryItems.Item_ID, qryItems.Item, qryItems.Type FROM qryItems WHERE (((qryItems.Type)=Forms!InvtBal_frm!TypeFilter));
VBA is
Private Sub LkUpItm_AfterUpdate()
On Error GoTo Oops
Dim rs As DAO.Recordset
If Not IsNull(Me.LkUpItm) Then
If Me.Dirty Then
Me.Dirty = False
End If
Set rs = Me.RecordsetClone
rs.FindFirst "[Item]='" & Me![LkUpItm] & "'"
If rs.NoMatch Then
MsgBox [LkUpItm] & " Not Found"
Else
Me.Bookmark = rs.Bookmark
End If
Set rs = Nothing
[LkUpItm] = Null
End If
Get_Out:
Exit Sub
Oops:
MsgBox Err.Description
Resume Get_Out
End Sub
Thank you for your time and patience with any help on this matter
Robert M