|
Bucaro TecHelp Newsletter
Maintain Your Computer and Use it More Effectively
to Design a Web Site and Make Money on the Web. ~ ~ ~ October 3, 2006 Volume 6 Number 6 ~ ~ ~
|
Create an Access Database Using Only Notepad
Part 11 Code for Edit Customer Form
By Stephen Bucaro
In this series of articles, you'll learn how to create a Microsoft Access
database using only a basic ASCII text editor, like Windows Notepad. That's
right, you don't need Microsoft's Office suite, or Access database application,
or Visual Basic programming environment in order to create an Access database.
All you need is your handy text editor.
In this example we will be designing an Order Entry System database. In previous
parts of this series you learned how to: create an HTML Application (HTA);
determine if the required Microsoft Data Access Components (MDAC) were installed
on your computer; design database tables following rules of normalization; and
about ActiveX Data Objects Extended (ADOX) Field Properties.
If you
missed previous parts of this series of articles, you can still collect the entire
series. Past issues of the newsletter are available in the Archive section of bucarotechelp.com
In Part 10 of this series you used Notepad to enter the code to create an Add
Customer Form to add records to the Customers table of the Order Entry database.
In this article you'll use Notepad to enter the code to create an Edit Customer
form that lets you edit records in the Customers table.
To create an Edit Customer form, navigate to the folder where you saved the
database and create a text file there. In that text file, type in the tags that
create an HTA Application, as shown below.
<html>
<head>
<HTA:APPLICATION NAVIGABLE = "yes">
</head>
<body>
</body>
</html>
In the body section of the HTML page (in other words between the
<body> tag and the </body> tag) enter the html code to create a
form, as shown below.
<form id="EditCustomerForm" >
First Name: <input type="text" name="FirstName"><br />
Last Name: <input type="text" name="LastName"><br />
Street: <input type="text" name="Street"><br />
City: <input type="text" name="City"><br />
State: <input type="text" name="State"><br />
Zip: <input type="text" name="ZipCode"><br />
Phone: <input type="text" name="Phone"><br />
Email: <input type="text" name="Email"><br />
Notes: <input type="text" name="Notes"><br />
<input type="button" value="Prev" onclick="PrevCustomer()">
<input type="button" value="Edit" onclick="EditCustomer()">
<input type="button" value="Next" onclick="NextCustomer()">
</form>
Now save the file with a name with an .hta extension, for example EditCustForm.hta.
Then double-click on the file name to execute the script. A window will open
displaying the Edit Customer form. The form doesn't actually work yet because we
haven't added the VBScript code to access the database.
Note that each element in the form has a name attribute and each is
assigned a unique name. We'll use these names to access the forms data. Also
note that the form has three buttons; "Prev", "Edit", and "Next". The
onclick event of each button is used to execute a VBScript Subroutine.
|