473,395 Members | 2,446 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Clear button for multiple combo boxes

I have a form with mulitple combo boxes that populates criteria in a query. I want to add a button to clear the selections in all of the combo boxes. What code do I use?

Thanks!
Mar 22 '07 #1
4 5997
This is what I have used:
Expand|Select|Wrap|Line Numbers
  1. Private Sub CommandClear_Click()
  2. Me.FiltRecName = Null
  3. Me.FiltCat = Null
  4. Me.FiltCost = Null
  5. Me.FiltIng1 = Null
  6. Me.FiltIng2 = Null
  7. End Sub
Hope it helps :)
Mar 22 '07 #2
ADezii
8,834 Expert 8TB
I have a form with mulitple combo boxes that populates criteria in a query. I want to add a button to clear the selections in all of the combo boxes. What code do I use?

Thanks!
Expand|Select|Wrap|Line Numbers
  1. Dim ctl As Control
  2.  
  3. For Each ctl In Me.Controls
  4.   If ctl.ControlType = acComboBox Then
  5.     ctl.Value = Null
  6.   End If
  7. Next
Mar 22 '07 #3
Thanks for showing a better way ADezii, my way works but yours is better. Can I do this:
Expand|Select|Wrap|Line Numbers
  1. Dim ctl As Control
  2.  
  3. For Each ctl In Me.Controls
  4.   If ctl.ControlType = acComboBox or ctl.ControlType = acTextBox Then
  5.     ctl.Value = Null
  6.   End If
  7. Next
Mar 23 '07 #4
Thanks it works great!! =)
Mar 23 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: MOHAMMED AZEEMUDDIN | last post by:
Hi, I''m looking for someone to help me out in ASP. I''ve 3 to 4 or more combo boxes. On the change event of the combo boxes I want to fill the values. Suppose I change the value in combobox1 the...
3
by: vgrssrtrs | last post by:
<html> <head> <script language="JavaScript"> <!-- /* *** Multiple dynamic combo boxes *** by Mirko Elviro, 9 Mar 2005 *** ***Please do not remove this comment
2
by: Tim Graichen | last post by:
I currently have a form with several combo boxes. I have the background properties and boarder properties of all form fields set as transparent. Therefore, the only part of the controls that are...
1
by: Shawn Yates | last post by:
It has been a while since I have done anything on MS Access and I seem to be a bit rusty. I hope someone could help me solve my issue. I have a form that has multiple combo boxes on it. Each box...
6
by: zuchowra | last post by:
Hi everyone. I need help. I have a combo box in my form that i want to populate multiple text boxes after you select your selection in the combo box. Here is my set up. The Fields that need to be...
3
by: Alo2aaa | last post by:
Dear all i have two linked combo boxes (master/child) ,the user wants to have multiple selection from both combo boxes , can u tell me how can i store them in a way that i can have a unique id...
1
by: dougmeece | last post by:
Good Morning everyone. I have a form with two combo boxes and 1 command button. I am trying to use the command button to search a table and populate a query. I will then have the query display the...
3
by: WiscCard | last post by:
This seems simple enough, but I am having problems. I have a table of customer information. I have a form with various combo boxes displaying unique customer information (in this case, zone and...
4
by: SKelso | last post by:
I created a database in Access 2003 that contains an unbound search form with several combo boxes. Each combo box is populated with entries from the appropriate table. I want to allow the user to...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.