473,655 Members | 3,105 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Clear Command Button then Requery Subform

6 New Member
Currently have a Multiple Field (from 4 fields or is Null, txtFiscalYear, cboUnit, cboItem, cboStore) search form that user can use to query and pull data. When user click on a query button the results show up on a sub-form. Would like to have a Clear Button where user can clear the result and then input different data to re-query on. Query work, however; when I hit the Clear button the query button does not return any results and does not seem to work anymore.

Using the following VBA code as an event procedure when clicked.
Query Button:

Expand|Select|Wrap|Line Numbers
  1. Me.subfrmInventorySearch.Requery
  2.  
  3. Clear Button:
  4.  
  5. Me.txtFiscalYear = ""
  6. Me.cboUnit = ""
  7. Me.cboItem = ""
  8. Me.txtItemName = ""
  9. Me.cboStore = ""
  10. Me.txtState = ""
  11. Me.txtCity = ""
  12.  
  13. 'Focus on Object Fiscal Year
  14. Me.txtFiscalYear.SetFocus
  15.  
Please advise on what I am doing wrong or how can I fix the code so when the user clears the txt and cbo in the form then inputs data they can re-query and results show on the sub-form.
May 6 '16 #1
1 1518
zmbd
5,501 Recognized Expert Moderator Expert
move line1 where you requery to after you clear the control values... say line 12


ALSO

Fields are NOT controls
Controls can be bound to fields in a table/query.

I know, by default, MS names the controls the same as the bound field and this can cause confusion between the two. It would be much better for MS to name the controls with something generic such as "ctrl_fieldname " to help people realize this difference.
May 6 '16 #2

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

Similar topics

6
59257
by: deko | last post by:
I have a several forms that accept user input in a textbox and then take some action based on that input after a command button is clicked. Is it possible issue the command when the user presses Enter rather than clicking the command button? I've tried this, but for some reason it's not working: Private Sub txtFind_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then Call cmdFind_Click End Sub
2
3845
by: Colin | last post by:
I have a main form with a command button on it that when clicked, opens a subform displaying records that relate to the main form. I would like to disable the command button if the corresponding subform does not contain a record. I'm guessing this action would take place in the OnClick event of the command button but I'm not sure what the VB code is for checking if a record exists. Any coding examples and suggestions would be very...
2
15710
by: dskillingstad | last post by:
I'm trying to assign a custom value to a textbox. Here's what I have. I've created a module and "default value" code for a textbox which generates a custom auto-number (yyyy-0000) when a New Record button is clicked. The code checks the table for the highest value and then assigns 1 and inserts the value. I have a second text box which needs the same type of custom auto-number which has to be generated from a second command button. ...
14
4960
by: Kevin | last post by:
A couple of easy questions here hopefully. I've been working on two different database projects which make use of multiple forms. 1. Where's the best/recommended placement for command buttons for things like delete, save, edit, cancel buttons - in the footer, or on the form detail section? 2. If in the footer, how do you add them to the tab order?
2
5201
by: emc_cos | last post by:
I have a very nice parent child relationship happening between a main form and 8 subforms. The main form is the data entry point for a table that holds textual data like names, notes and the like. It also holds the primary key which is an alpha-numeric file designation. The subforms are the data entry point for another table that holds numeric values for time spent on tasks.
14
11460
by: Kurt | last post by:
I have an unbound main form with an unbound subform. frmProjects fsubProjectList Using combo boxes, the user can select several search criteria on frmProjects and then click a command button. The command button passes the criteria as a string to a query. A subform, which is based on this query, shows the results of the search.
0
1847
by: M G Henry | last post by:
I am using Access 2003 and have a form with two subforms on them. I would like to be able to use a command button to add the row of data ( 5 fields ) that are completed on the subform, as well as refresh the parent form which has a list box that shows the values from the first field ( custname ) that have been added thus far to the table linked to the subform. My form has two subforms and I would like the command buttons to work...
1
3436
by: Chris | last post by:
I need a search form to perform. I have a Form and a subform. The subform is based off a query and the main form is unbound. The query runs perfect, however, I have a command button in the main form with the code: Private Sub Command12_Click() Me.Refresh End Sub That command button is not working and gives me the prompt, "Error
4
4114
beacon
by: beacon | last post by:
Hi everybody, I have a main form, frmDeficiency, that has a tab control, deficiencyTabControl, that has a subform, fsubEpisodeDetail, on page 2 of the tab control. I also have a command button on the main form that I'm going to be using to submit the data. The main form is bound to a query, qryPatientDetail, and is filtered using a search form. The subform is currently linked to the main form with PatientDetailID as the Master and...
0
8380
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
8816
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
8710
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
8497
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,...
1
6162
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
5627
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();...
0
4150
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4299
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1598
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.