Go Back   DeveloperBarn Forums > Databases > Microsoft Access

Sponsored Links

Discuss "Adding ALL Button to Combo Box" in the Microsoft Access forum.

Microsoft Access - Microsoft Access is a database for small to medium applications. Learn tips and tricks and best database practices here.


Reply « Previous Thread | Next Thread »  
 
LinkBack Thread Tools Display Modes
  #1  
Old July 8th, 2008, 12:16 PM
Barn Newbie
 
Join Date: Jul 2008
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 1
Northernlion is an unknown quantity at this point
Default Adding ALL Button to Combo Box

Hey guys I have a problem that's been giving me trouble for a couple days now. I have a search form with several combo boxes and buttons to generate reports. The values of the combo boxes feed into the query criteria then the report generates records based on these criteria.

All but one of the combo boxes are based on values I type in. The other is based on a table named tblCampaigns that has only one field: CampaignName. What I would like to do is get this combo box to have an ALL option that brings up records based on every campaign name. Here's my current row source:

SELECT tblCampaigns.CampaignName
FROM tblCampaigns;

Thanks in advance!
Reply With Quote
Sponsored Links
  #2  
Old July 8th, 2008, 12:24 PM
AOG123's Avatar
Lightning Master

 
Join Date: Mar 2008
Location: Fortress Of Solitude
Posts: 93
Thanks: 6
Thanked 23 Times in 18 Posts
Rep Power: 1
AOG123 is on a distinguished road

Awards Showcase
Microsoft Access 
Total Awards: 1

Default

I assume your using a query to provide the filters based on the combo value?

Lets say your report is based on a query,. using the below in the criteria of the field you are filtering will provide all when the combo is left blank.

Code:
 Like "*" & [Forms]![FormName]![ComboName] & "*"
Let me know if i'm on the right track

Comments on this post
Northernlion agrees: Thanks!
__________________
If i helped you, make me famous by clicking the
Reply With Quote
  #3  
Old July 8th, 2008, 12:29 PM
Barn Newbie
 
Join Date: Jul 2008
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 1
Northernlion is an unknown quantity at this point
Default

Thanks man, that works great!

Just one thing though,

This works when the value for the combobox is blank. Is there anyway to make the blank value say "ALL" without adding another column? Alternatively, is there any way to make the blank an option? As of right now it's just the default value and then when you click another campaign you can't get back to it.
Reply With Quote
  #4  
Old July 8th, 2008, 01:03 PM
AOG123's Avatar
Lightning Master

 
Join Date: Mar 2008
Location: Fortress Of Solitude
Posts: 93
Thanks: 6
Thanked 23 Times in 18 Posts
Rep Power: 1
AOG123 is on a distinguished road

Awards Showcase
Microsoft Access 
Total Awards: 1

Default

I'm not sure at the moment about adding an "all" to the selection as this would be criteria filtered on.

But the easiest way to clear the filter would be to add a small command button next to the combo with the following on click event.

Code:
Private Sub Command_Click()
Me.ComboName = Null

End Sub
Reply With Quote
Reply

  DeveloperBarn Forums > Databases > Microsoft Access

Bookmarks

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
adding numbers todd2006 JavaScript Programming 2 July 3rd, 2008 01:38 PM
Combo Box - Add Entry Not In List AOG123 Microsoft Access 0 June 6th, 2008 09:35 AM
delete button techker Microsoft Access 14 May 21st, 2008 08:56 AM
Webform Default Button Devwhiz .Net Development 9 May 15th, 2008 01:15 PM
[ASP/VBScript] Dynamic Combo Maker mehere Code Samples 0 March 28th, 2008 09:40 AM


All times are GMT -4. The time now is 02:51 PM.



Content Relevant URLs by vBSEO 3.2.0