473,698 Members | 2,503 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Clearing Text/List boxes for new search

114 New Member
I'm on the home streach of my project and found that my "Reset for New Search" command button not working as desired. What should happen is that when the button is clicked a Event Procedure is run. That event procedure should clear the text boxes that are used for a search query that loads the results into a list box on that same form.

When clicked, all is cleared in the text boxes, and the list box is cleared but shows column seperator lines in 1st row only . After entering new search data (let's say box 2 of the 3 boxes, and the search data is on the table) the "Search" button is clicked, the list box clears completely and nothing showing.

What I discovered is if I enter something in all 3 text boxes (say x, x, x) and click "Search" nothing happens, and then go back and delete 1st box, enter valid data in 2nd, delete 3rd and click the "Search" button again, the list box get populated like it should of after clearning the 1st search.

I can change any of the text box values and click "Search" not using the clear button, and that works loading new rows in that list box. Just the clear before a new search has problems.

Here is the code for the clear button click:

Private Sub clearButton_Cli ck()
On Error GoTo Err_clearButton _Click
' clear the 3 text boxes, list box so that another search/query can be done
Me.WhatLastName .Value = ""
Me.WhatFirstNam e.Value = ""
Me.WhatMedRecNo .Value = ""
Me.SelectPrintI tems.RowSource = ""
Me.Refresh

Exit_clearButto n_Click:
Exit Sub

and here is the code for the search button click:

Private Sub SearchQuery_Cli ck()
On Error GoTo Err_SearchQuery _Click

'Error checking to make sure user entered values for Last Name and First Name.
If Nz(Me.WhatLastN ame, "") & _
Nz(Me.WhatFirst Name, "") & _
Nz(Me.WhatMedRe cNo, "") = "" Then
MsgBox ("Please enter a Search value, all 3 may not be blank")
GoTo Exit_SearchQuer y_Click
Else
Me.SelectPrintI tems.RowSource = "Lukup_Quer y"
Me.SelectPrintI tems.Requery

End If
Exit_SearchQuer y_Click:
Exit Sub

The Lukup_Query is just a Select using the What... fields above in a WHERE statement to select for populating the list box.

Should work but I must be overlooking something that is obvious
Jan 1 '07 #1
12 9811
MMcCarthy
14,534 Recognized Expert Moderator MVP
Expand|Select|Wrap|Line Numbers
  1. 'Me.SelectPrintItems.RowSource = ""
Comment out this line and see what happens
Jan 1 '07 #2
ljungers
114 New Member
Expand|Select|Wrap|Line Numbers
  1. 'Me.SelectPrintItems.RowSource = ""
Comment out this line and see what happens
When commented out all text & list box get cleared (no col seperators) but functionality still remains the same.
Jan 1 '07 #3
MMcCarthy
14,534 Recognized Expert Moderator MVP
When commented out all text & list box get cleared (no col seperators) but functionality still remains the same.
Try doing the same with the text boxes just leaving Me.Refresh
Jan 1 '07 #4
ljungers
114 New Member
Try doing the same with the text boxes just leaving Me.Refresh
When all are commented out the Clear does nothing, but the Search works every time with any changes to any of the text boxes.
Jan 1 '07 #5
MMcCarthy
14,534 Recognized Expert Moderator MVP
When all are commented out the Clear does nothing, but the Search works every time with any changes to any of the text boxes.
Expand|Select|Wrap|Line Numbers
  1.      Me.WhatLastName = Null
  2.     Me.WhatFirstName = Null
  3.     Me.WhatMedRecNo = Null
Try this instead for the text boxes.

BTW are the textboxes bound to controls. If not the refresh should have worked.

Mary
Jan 1 '07 #6
ljungers
114 New Member
Expand|Select|Wrap|Line Numbers
  1.      Me.WhatLastName = Null
  2.     Me.WhatFirstName = Null
  3.     Me.WhatMedRecNo = Null
Try this instead for the text boxes.

BTW are the textboxes bound to controls. If not the refresh should have worked.

Mary
that seems to work ok, just when the form open 1st time and when the Clear button is clicked the entire table is listed in the list box (29230 records). In design mode the text boxes and list box all show Unbound
Jan 1 '07 #7
MMcCarthy
14,534 Recognized Expert Moderator MVP
that seems to work ok, just when the form open 1st time and when the Clear button is clicked the entire table is listed in the list box (29230 records). In design mode the text boxes and list box all show Unbound
Try setting the listbox RowSource to "" again while leaving the textboxes set to null.
Jan 1 '07 #8
ljungers
114 New Member
Try setting the listbox RowSource to "" again while leaving the textboxes set to null.
That seems to work as to clearing text boxes, and the list box, except the column dividers for the 1st row show, but can live with that.

The search works OK now and the only thing is that the list box loads the entire table when the form is first opened.
Jan 1 '07 #9
MMcCarthy
14,534 Recognized Expert Moderator MVP
That seems to work as to clearing text boxes, and the list box, except the column dividers for the 1st row show, but can live with that.

The search works OK now and the only thing is that the list box loads the entire table when the form is first opened.
Call the clear button event in the On load event of the form

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Load()
  2.  
  3.    clearButton_Click
  4.  
  5. End Sub
Mary
Jan 2 '07 #10

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

Similar topics

2
1857
by: Savvas | last post by:
Hi everybody, I have a lot of textboxes on my form and a "Clear" button. Is there a way with a for loop or something to clear the textboxes, instead of writing textboxName.clear? Thanks a lot
3
392
by: Alex Wisnoski | last post by:
I have an edit record form with several text boxes, combo boxes, and check boxes. All of them are bound except for one combo box (cboPositionData), which I use to search for a specific record. I have a Clear button which I have coded to use the Me.undo if the form is dirty. I am testing for a situation in which the user would stop trying to enter data in cboPositionData and clear the form. When I enter a partial value in...
2
3836
by: Jack Smith | last post by:
My development environment is ASP.Net with Vb.Net and Java script with .Net Framework 1.1 and IE 6.x. I have a search window and once the user done with search, if user wants to clear the search text fields/search result (data grid) they can click the clear button. I used server side button control for the clear button. To clear the search result in the data grid, I am rebuilding the data grid
5
1596
by: Drew Leon | last post by:
I have a Form with a Tab Control on it. Each of the Tabs have two List Boxes on them. When you Select an Item from the List Box, the Text Box at the bottom of the Form gets populated. I would like to have the Text Box clear itself when I switch Tabs. Any assistance would be greatly appreciated. Thank you, Drew Leon. -- Have a great day! Drew Leon
7
4513
by: ljungers | last post by:
Have Form-1 with 3 text boxes and 1 command button. With any of the 3 boxes filled out and button is clicked, a Macro is performed that Opens a Query that has a WHERE clause that uses the 3 test boxes of data from form-1. 1) How do I cause the SQL command window not to show for that SQL command? The query results is placed in a ListBox on Form-2 and desired rows in the list box are selected/clicked, followed by a click on a button that...
7
1309
by: Tim Hitchcock | last post by:
I have written a couple of programs in C# using Visual Studio.NET 2003. Both of these programs have the problem that when they are ran on my Windows XP computer at work items in list boxes and text in message boxes appears invisable. The items are actually added to the list box because you can run the highlighted selection up and down in the list box as many times as the number of items that were added. In the first program whose...
6
4666
by: woodey2002 | last post by:
Hi Everyone. Thanks for your time. I am trying to create a search form that will allow users to select criteria from multiple multi select boxes. So far i have managed to achieve a search option for 2 list boxes:- county and nationality, while trying to add a third multi select list box for qualifications search is where i encounter my problem. I've copied the working code from my working list boxes, however it cant seem to pick up the...
8
3355
by: hollinshead | last post by:
Hi there i have bit of an issue. i haver this database that is purely used for searching records under certain criteria. This criteria is chosen by the user on a form using list boxes and combo boxes. So when the criteria is chosen the user selects a click command button and then the results are displayed on another form. I have successfully created the code for the combo boxes on the form.The list boxes are are the problem which are set to...
2
3036
by: hollinshead | last post by:
hi there, i have been having this issue for quite some time now and i cant seem to get my head around it. I am trying to create a database for candidates CV's and covering letters. basically the data that is stored is made up of qualifications and areas of business that candidate is involved etc. My problem is with the query by form where i have a range of combo boxes and list boxes. The combo boxes are working fine, no problem however the...
0
8680
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9169
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9030
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8899
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8871
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6528
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5861
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
2335
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2007
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.