Help - Standard Form Template

ShaunWillmott

Registered User.
Local time
Today, 06:54
Joined
Dec 21, 2001
Messages
17
Dear Forum,
I'm currently updating one of my Access 2000 applications for a local Charity, one of the major issues with the current one is that it uses standard forms built using the Access forms wizard and then amended to suit, this has caused some problems because the users keep leaving the form open and then keys are pressed inadvertently and data gets changed.

I want to have a form that only allows the user to move forward/back through records and search, but they would need to press a button to edit, delete, add records and if any data was changed they would be asked to save the record.

Anyone got a standard form with buttons and the code behind them that would help me cut down on development time????

Cheers

Shaun
 
The closest I can come on this is to set some of the form's data properties (Allow Edits, Allow Deletions, Allow Additions) to No.

Then set up an "EDIT" command button that will change these properites to Yes to allow the user to make changes to the current record.

Me.AllowEdits = True
Me.AllowDeletions = True
Me.AllowAdditions = True

Then in the After Update event of the form:

Me.AllowEdits = False
Me.AllowDeletions = False
Me.AllowAdditions = False

This will again "lock" the form once you move to another record. I can't come up with a way to lock the form after every edit within a record because the form's before/after update events do not seem to fire until you exit the current record. To do this, you would have to insert an after update event for every control on the form.

I also can't find a way to supress saving the changes because that is done automatically in the form. Again the only option is to insert a before update event for every control.

At least this method will help prevent accidental edits.
 
There are lots of posts here on controlling updates. The important thing you need to remember is that ALL updates funnel through the form's BeforeUpdate event immediately before the record is saved. So, any trapping you want can be done in that event. If you find errors, you can cancel the update event to prevent the changes from being saved.
 

Users who are viewing this thread

Back
Top Bottom