use combo box (1 Viewer)

supiansyarif

New member
Local time
Today, 21:56
Joined
Apr 24, 2020
Messages
13
Daer All Master MS Access

for MS Access masters, I currently use MS Access 2010, and I want the steps to create a filter using the combo box on the form, I made the combo box inactive

thanks,
Supian
 

Attachments

  • Combo box.jpg
    Combo box.jpg
    203.4 KB · Views: 337

CJ_London

Super Moderator
Staff member
Local time
Today, 13:56
Joined
Feb 19, 2013
Messages
16,553
in your combo after update event put

Code:
me.filter="[code unik]='" & me.mycomboname.column(0) & "'"
me.filteron=true

note if your bound column is the same as the first visible column in your combo, you do not need .column(0)
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 21:56
Joined
May 7, 2009
Messages
19,169
alternative to the previous solution.
still on combo's AfterUpdate Event:

private sub combo_afterupdate
if me.combo.listindex > -1 then
docmd.applyfilter , "[code unik] = '" & me.combo & "'"
' if the visible value on combo is not the bound column:
'docmd.applyfilter , "[code unik] = '" & me.combo.Column(1) & "'"
else
' remove the filter
docmd.showallrecords
end if
end sub
 

supiansyarif

New member
Local time
Today, 21:56
Joined
Apr 24, 2020
Messages
13
alternative to the previous solution.
still on combo's AfterUpdate Event:

private sub combo_afterupdate
if me.combo.listindex > -1 then
docmd.applyfilter , "[code unik] = '" & me.combo & "'"
' if the visible value on combo is not the bound column:
'docmd.applyfilter , "[code unik] = '" & me.combo.Column(1) & "'"
else
' remove the filter
docmd.showallrecords
end if
end sub

Cant you tray the atttachment
 

Attachments

  • Database3.zip
    26.2 KB · Views: 293

bob fitz

AWF VIP
Local time
Today, 13:56
Joined
May 23, 2011
Messages
4,717
I've applied the code given by arnelgp in post #6 to the attached db.
Hope this helps.
 

Attachments

  • Database3a.zip
    30.7 KB · Views: 378

Users who are viewing this thread

Top Bottom