A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Filter Combo boxes using Visual Basic



 
 
Thread Tools Display Modes
  #1  
Old April 12th, 2010, 09:59 AM posted to microsoft.public.access.forms
azza
external usenet poster
 
Posts: 8
Default Filter Combo boxes using Visual Basic

I am trying to apply a filter to my combo box using Visual Basic in Access
2007.
The ultimate aim is for the combo box to update after applying a filter to
the whole form using buttons - Show All or Show Current (Which is my currrent
members).
The form opens with the default of Show Current.
I have been playing with various forms of the following.
DoCmd.ApplyFilter , "current = True"
&
me.refresh
Even if I could just get the combo box to refresh after filtering the main
form with the new selection that would be great. Whatever way works.

Thanks
  #2  
Old April 13th, 2010, 02:19 PM posted to microsoft.public.access.forms
Daryl S[_2_]
external usenet poster
 
Posts: 881
Default Filter Combo boxes using Visual Basic

Azza -

Replace the row source with the SQL statement that has the filter in the
SQL. Something like this:

Me.lstBoxName.RowSource = "SELECT fieldname FROM tablename WHERE
filtercriteria"
Me.lstBoxName.Requery

--
Daryl S


"azza" wrote:

I am trying to apply a filter to my combo box using Visual Basic in Access
2007.
The ultimate aim is for the combo box to update after applying a filter to
the whole form using buttons - Show All or Show Current (Which is my currrent
members).
The form opens with the default of Show Current.
I have been playing with various forms of the following.
DoCmd.ApplyFilter , "current = True"
&
me.refresh
Even if I could just get the combo box to refresh after filtering the main
form with the new selection that would be great. Whatever way works.

Thanks

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 01:40 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.