Changing an Access Database

Changing a Database involves either inserting, updating or deleting records. These all require that the Access database to be changed has the necessary write permissions set.

The following examples involve setting up a similar connection as found before for just querying the database. The execute command is still used to pass the SQL query to the database, the only difference is that it uses either an INSERT, UPDATE or DELETE command, rather than a SELECT statement.

Inserting New Data

To insert data into the DEPT table, involves the three files: the form to get the new information, the ASP file to add the data and an error file to check for any errors, such as duplicate primary key values:

Inserting - DEPT table Source code Try it

Update Connection

The following examples show how to just update one row - moving just one employee's department, or updating everyone in one department to another.
Do not forget to change the data back at the end!

Updating Access - One Employee Source code Try it
Updating Access - One Department Source code Try it

Write Permission

By default the permissions on an Access database are set to read only, to allow updates to a database the permissions need to be set to allow writes too.

Do one of the following:

cacls database.mdb /e /g unv\WebProcesses:w

Where database.mdb should be replaced with the name of your database. This sets the Access Control List (ACL) for this file, so that external web processes (WebProcesses) can have write permission (w).

Write Permissions