filter ?

  • Thread starter Thread starter Guest
  • Start date Start date
Use VBA code to change the form's recordsource in the combo's after update
event, or base the form's recordsource on a query that reads the combo's
value and requery it in the combo box's after update event.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads
http://www.datastrat.com
http://www.mvps.org/access
 
Alternatively, you can filter the form based on your combo box, cmbName,
selection.

Private Sub cmbName_AfterUpdate()
On Error GoTo Err_cmbName_AfterUpdate

If IsNull(cmbName.Value) Then
Me.Filter = ""
Me.FilterOn = False
Else
Me.Filter = "[strName]='" & cmbName.Value & "'"
Me.FilterOn = True
End If

Exit_cmbName_AfterUpdate:
Exit Sub

Err_cmbName_AfterUpdate:
MsgBox "cmbName_AfterUpdate Error: " & Err.Number & ": " & Err.
Description
Resume Exit_cmbName_AfterUpdate
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

Back
Top