Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to clear a text box on a form? 1

Status
Not open for further replies.

nexus

Programmer
Jun 16, 1999
28
CA
trying to create a form in an address database to add a new address, but I can't make it start with a blank form, and if I try and close the form when the text boxes are empty, it says I can't have an empty string in my primary id. stupid question, but I'm trying to learn everything possible about Access programming within the week, because I'm going to be working with it for the next 8 months. Thanks!<br>
<br>
(I'll probably be posting a lot in the next little while)
 
The defualt view of an Access form is showing the first record. this is so you can get to work finding data or other things.<br>
If you want to add a new record do what WP mentioned above or<br>
Create an Add button when you want to add a new record.<br>
It will then clear all of the fields in h tebuttons' click event to make a date have today's date and or set the cursor blinking in a certain field. And on and on.you can also create an Add New button using a macro.<br>
Access has all kinds of wizards to help.<br>
Make sure the Wizard is checked in the ToolBox before adding a button.<br>
<br>

 
thanks... trying not to use the wizards, I'm pretty sure I have to know the code.
 
thats the best way to learn code Let Access teach you when it creates code with wizards.<br>
Been using Access for 7 years since version 1.1 and I let it do the work so you can keep your mind on the bigger picture.
 
Could n't have put it better Doug.<br>
<br>
Nexus, you say you have to know the code ?<br>
<br>
Why are you messing around with bound forms with all their little annoying problems? To be amongst the best ACCESS developers you need to learn to work with unbound forms and use DAO to perform record operations.<br>
<br>
However, in learning the complexities of DAO you will not be very productive. <br>
<br>
In the early stages of learning ACCESS you should stick with bound forms - use the wizards to create forms and the operations there in.<br>
<br>
WP <p>Bill Paton<br><a href=mailto:wpaton@neptune400.co.uk>wpaton@neptune400.co.uk</a><br><a href=
 
Right, it's faster & easier to learn common functions by using the wizards, then of course looking at the code they create behind the objects. But in some cases Access wizards may use outdated code. That is, they use code the current version is backwards-compatible with, rather than the latest version. You can catch these if you look through the &quot;new in this version&quot; section of your manual. Also the wizards don't usually add error checking, which is important to good programming. It's just a few extra lines to add in the OnError stuff. So I would recommend (1) use a wizard (2) look up any unfamiliar functions, and update them if desired and (3) add error handling. <br>
<br>
In this case, if you only want the form to add new items (never read old ones), just set the form's DataEntry property to Yes.
 
Thanks so much for the help and advice everyone!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top