473,385 Members | 1,531 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,385 software developers and data experts.

A reset Button for an Access Form

abouddan
Hi all

I have an Access2000 form that contain many TextBoxes and a button. That button inserts the data in tables.
How can reset all the TextBoxes automaticly without doing that one by one and manualy?

Many thanks
Feb 19 '07 #1
5 11621
NeoPa
32,556 Expert Mod 16PB
You could try :
Expand|Select|Wrap|Line Numbers
  1. Call Me.Undo()
...from within your code.
Feb 19 '07 #2
nico5038
3,080 Expert 2GB
NeoPa is right, but the safest way is to use:

If Me.Dirty then
Me.Undo
endif

This will make sure no error message is triggered when performing an Undo on a form not yet filled.

Nic;o)
Feb 19 '07 #3
Thanks for your support.
I don't know why neither of the two sugestions works. I put a break point on
"If Me.Dirty ..." and when the code run, he stoped on it and when hovering on "Me.Dirty" the result was "False" eventhought that all TextBoxes are filled.
So I wrote this: "If Me.Dirty = False Then Me.Undo" . The code worked and the test was good but nothing happenned when running "Me.Undo" .
I did some researches and I found this code and it worked very well.

Expand|Select|Wrap|Line Numbers
  1. Dim ctlC As Control
  2. For Each ctlC In Me.Controls
  3.   If ctlC.ControlType = acTextBox Or ctlC.ControlType = acComboBox Then
  4.     ctlC.Value = ""
  5.   End If
  6. Next ctlC
Feb 20 '07 #4
nico5038
3,080 Expert 2GB
The Me.Undo will only work for "bound" fields.
When you have unbound fields you'll need indeed such a loop to force the field(s) to be initialized.
It's however rare that you use unbound fields in Access as the bound fields are so easy to use :-)

Nic;o)
Feb 20 '07 #5
NeoPa
32,556 Expert Mod 16PB
You're probably better off using Null rather than an empty string there. Null is typically used (and therefore more easily recognised) as an unset value.
Expand|Select|Wrap|Line Numbers
  1. Dim ctlC As Control
  2. For Each ctlC In Me.Controls
  3.   If ctlC.ControlType = acTextBox _
  4.   Or ctlC.ControlType = acComboBox Then ctlC = Null
  5. Next ctlC
Feb 20 '07 #6

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

Similar topics

2
by: Matt | last post by:
i need to implement a clear button to clear all the fields in the form, but i am thinking i can just use reset button. <input type="reset" name="reset" value="CLEAR"> The first thought is...
1
by: Joe Bloggs | last post by:
I have a form which includes a checkbox field. I need to add a reset, I add a HTML reset it works fine before I submit the form but not after. I know I must add some code to reset the checkbox on...
4
by: Chris Lane | last post by:
Hi, I have an HTML RESET button and Web Control Button that posts back to the server. Problem is the reset button doesn't work after the postback occurs. Any ideas or suggestions as to why this...
2
by: angus | last post by:
Dear All, I have to implement a reset button in the web form. i think that i can use the web component(button) to get the fired onclick event on the reset button. after the postback, the...
1
by: NancyASAP | last post by:
Thought I'd share this since it took me a long time to get it working. Thanks to a bunch of contributers in Google Groups who shared javascript, etc. The question was: How can I put a reset...
7
by: Kermit Piper | last post by:
Hello, How can you clear session variables when a reset button is pressed? I thought I might be able to do something like: <% If request.form("Reset") = "Reset" then Session("variable") =...
3
by: kashif_khan | last post by:
hi everyone, can anybody please tell me why reset button is not working in the following code, i tested it in opera, firefox and konqueror, <form action='edit_links.php' method='POST'...
16
by: Animesh K | last post by:
What's the best practice for using an image for a reset button? Unfortunately, we cannot use <input type="image" src="..."in this case. Any helpful tutorial from the web will be appreciated. I...
4
by: tomb | last post by:
Hi, can someone make sense of this? I am using AJAX to populate a <div>, which is working very nicely, except for one thing: My reset button in the resulting <formis dead. When I put a...
2
by: azura | last post by:
dear sir.. before this i using flash button for clear/reset the form.. it's work but when i upload into server the flash button dissapear... so i had to change it using coding button but i don't...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.