combo boxes: re-post from Form group

S

Sam Kuo

This may sound a bit mouthful, but the desired outcome is simple. I'm not
code literate so could someone please help! Many thanks :)
The following codes sychronize two combo boxes, where the latter is limited
by the selection of the former. Right now records are filtered only after
both selections. But what I really want is:
1) record in form filtered after 1st combo box, and filtered futher after
2nd combo box.
2) have a OK button next to both combo boxes, so that filter doesn't take
place until the button is clicked.

Private Sub cboCategory_AfterUpdate()
Me.cboType.RowSource = "SELECT Type FROM" & _
" qryTypeCurrent WHERE CategoryID = " & Me.cboCategory & _
" ORDER BY Type"
Me.cboType = Me.cboType.ItemData(0)
End Sub

Private Sub cboType_AfterUpdate()
DoCmd.ApplyFilter , "Type = '" & cboType & "'"
End Sub
------------------
I also have another combo box in the same form which provides an alternative
mean of record finding. But I would like the previous 2-combo-box-set to be
cleared (display as blank) if this combo box is later used.

Private Sub cboDWGNo_AfterUpdate()
' Remove the filter.
Me.FilterOn = False
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[DWGNo] = '" & Me![cboDWGNo] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top