AutoSave

D

dgodfrey

Hello,

I am aware that Access saves information on a form when you close the from,
which is good. How do I code my database so that it autosaves at set time
intervals like Word does? We do not want an idle user timeout or say, power
failure/system lockup to lose data entered...we want to be able to load it
back up and resume where we left off.

Thanks.
 
K

Klatuu

If your database is split and the back end database is on an network server,
you don't have to worry about it. It is automatically saved using the
Refresh Interval setting in Tools, Options, Advanced tab. The default is 60
seconds.
 
L

Linq Adams via AccessMonster.com

How many controls per record are we talking about here? Access does usually
save the data for the current record when the form is closed, depending on
exactly how the form is closed and whether required fields, if any, are
populated, but it also saves the data for a record when you move to another
record. The most data you will ever lose if that for the current record.

You could set up a saving routine using the form's Timer event and either

If Me.Dirty Then Me.Dirty = False

or

docmd.RunCommand acCmdSaveRecord

Something like this, where "M" is the number of minutes between saves:

Private Sub Form_Load()
Me.TimerInterval = 60000 * M
End Sub

Private Sub Form_Timer()
If Me.Dirty Then Me.Dirty = False
End Sub

Having said that, this is a using a lot of resources, for this purpose, with
the timer continuously running.
 
M

Marshall Barton

dgodfrey said:
I am aware that Access saves information on a form when you close the from,
which is good. How do I code my database so that it autosaves at set time
intervals like Word does? We do not want an idle user timeout or say, power
failure/system lockup to lose data entered...we want to be able to load it
back up and resume where we left off.


You will need to use the form's Timer event to do something
at fixed intervals. This line can do the save:
If Me.Dirty Then Me.Dirty = False

***BUT*** you will also need to analyze all potential
scenarios where this can occur. E.g. what if a user is in
the middle of entering a value and the timer triggers a
save?

Tou will have to go to great pains to deal with any
validation rules or referential integrity restrictions that
might be violated by an incomplete field or record.

There are probably more complications in this than can
reasonably be coded around and I think pursuing this idea
will only dig yourself into a deep, deep hole.
 
D

dgodfrey

I believe that is how it is going to be done in the, so this makes me feel
better.

Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top