Filter query based on combo box selection (1 Viewer)

Ossama22

Registered User.
Local time
Today, 03:20
Joined
Aug 31, 2018
Messages
52
Hello guys ,
I wanna to know if i have form with a combo box ( contain alot of codes ) , and i have query with the full data of this codes , i wanna the vba code to a button when i click on it , which is filter the query as per the code i choosed from combo box , is that possible ?
 

Ranman256

Well-known member
Local time
Yesterday, 21:20
Joined
Apr 9, 2015
Messages
4,339
in the combo box AFTERUPDATE event:

Code:
sub cboBox_Afterupdate()
If IsNull(cboBox) Then
  Me.FilterOn = False
Else
  Me.Filter = "[CCode]='" & cboBox & "'"
  Me.FilterOn = True
End If
end sub
 

Users who are viewing this thread

Top Bottom