Is there a similar function to excel's activeworkbook.save for access?

kate10123

Registered User.
Local time
Today, 00:52
Joined
Jul 31, 2008
Messages
185
Hi there,

I really want to add a save function that runs say every 10 to 15 minutes to save the current record displayed.

Is this possible in access?

Kate :)
 
- This is possible, but reasonably pointless. Access saves the current record when you navigate away from it.
- What's happening in your workflow that makes this seem like a good idea? Why does the current record hang around so long?
- You can run a timer using a form's OnTimer event, which will run if the form's TimerInterval property is non-zero. This value will be the milliseconds between firings of the event.
- You can save a record using the Refresh method of a form, or setting the Dirty property to False.
 
Hi,

Thanks for replying. The reason why I am looking for this kind of function is because the users are tutors and use the database to make notes on students, sometimes they can be in the record for 20 minutes (collating thoughts about what to write before actually typing it in the database)
and in the past they have found that if the database stops responding they lose all their notes.

So I thought if I could have an autosave work in the background then it would at least save some of the data.
 
they aren't really in the record

(by default its called optimistic locking - ie no locking!)

what access does is gives them a copy of the record

when they save it, it rereads the record to see if it changed in the meantime

if it did, it tells them they cant save it - if it didn't it just saves it.

---------
you are right in saying that Access could lose notes, if it stopped responding. One alternative is for the users to edit the notes in notepad, or something like that, then just cut and paste into access.

another way is to put the record selector bar on the form, (thats a vertical bar to the left of the records) When you edit something the black triangle changes to a pencil to show the user the record is changed. They just need to click the pencil to save their changes from time to time.
 
Access has a sample based on detecting idle time. It counts down from a preset number of minutes and checks for any keyboard or mouse activity. If either arre not detected you can do something significant at that point (DSSP) Do Something Significant Point. This could work for you.

CodeMaster::cool:
 
the trouble is that forcing a record save may not be advised either -

1. - you will have to write extra code to handle failed saves, in the event the record wasnt completed properly

2. you lose the ability to change your mind and undo the edit, after the timer saves your partial edits

just give the users the abilitiy to save their work, and warn them they might lose it if they dont
 
Hi further to my original post, I decided to just put a save button on the form and explained to the users that this was available to click at any time to save the record.

Some of the users would prefer an autosave, rather than having to click the button to save.

One part of filling out a record can take a long time because it involves the user typing up notes. This is why ideally I want to put a timer on the following code to execute every 5 mins.

Code:
DoCmd.RunCommand acCmdSaveRecord

I thought I could put this on the after update event of the memo field that the users put the notes in.

Any ideas?
 
Maybe put a counter on your autosaver, so that they know it's coming, and it doesn't surprise people who don't want the autosave to remove their ability to undo unexpectedly.
 
At this point we are branching into philosophical issues. You are now building a database to suit your users, which is treading very close to the line wherein the tail wags the dog.

An auto-save function, while it sounds convenient, causes data thrashing if someone steps away from the workstation. Forcing a save on a timer is going to increase database bloat in the long run.

If you are trying to be a nice person but distorting your application to meet someone else's expectations, you are going to blur the design of the application. Advise your users to think about what they wanted to say ahead of time, then enter it. Advise them that letting them sit around and stare out the window 20 minutes while thinking makes their lives easier but costs you time (to program), money ('cause time IS money, after all), and data security (because the open record can get caught in a partially updated, therefore inconsistent, state.

If their work paradigm requires you to jeoparize your database, I don't think that's a fair trade. If you are the supervisor, you can MAKE the rules. Even if you are not, you can talk to the person who IS the supervisor and point out that there is a problem with this method of working.

Maybe I'm taking an extreme view, but that's because I am in an extremely conservative shop where an idle terminal is not merely undesirable, it is actually a security violation.
 
Cheap way: Unbound time/text field with the label "Next autosave at:". When you run the Autosave code above, add the line Me.unboundDateTime = Now() + 0.0034722 (change value as needed - that should be five minutes). Format field as appropriate (don't forget to give it an initial value when they start the entry). You can shine things up by making this time reset if they manually save the record, but make sure to adjust your TimerInterval as well.

Cooler way: Same field, but the label is "Next autosave in:" and the format is probably plain text. Starting value is "5:00 minutes", or whatever. TimerInterval is 1000 (milliseconds, remember); decrement the displayed value by one second. You can also make it do this less often, like every 15 seconds, if it gets too distracting. This version probably requires a global variable, depending on how you want to format the field (you can get away with not doing that if you format it down to M:ss and assume they'll know it's 5 minutes, not 5 hours).
 
While I agree with Doc that we're getting into extremely low-importance issues, the bigger problem to me is why are your users typing for 15 minutes on a single form. There may legitimately be no way to speed that up, and I definitely don't recommend the use of Notepad etc (academics will save their stuff any-damn-place if left unattended).
 
The users that are using the database are academic tutors so they use it to record notes on the tutorials they have given to students. This is why they are on the form for sometimes 15 mins or longer.

The reason for an autosave is because there have been some network connection problems which is where the backend of the database is stored. With autosave, at least some of the data can be recovered but I completely agree with the previous posts to this that it could be unnecessary.
 
While I agree with Doc that we're getting into extremely low-importance issues, the bigger problem to me is why are your users typing for 15 minutes on a single form. There may legitimately be no way to speed that up, and I definitely don't recommend the use of Notepad etc (academics will save their stuff any-damn-place if left unattended).

It is very common with telemarketing to have a field sitting half completed for 10 minutes or so. It will be for a new record on a second form opening where appointment details are being entered. Same sort of thing often happens when file notes are being made.
 
to go back to my earlier ideas

either
a) get the users to enter the notes in notepad - then copy and paste the notes into a memo field on your database - that way the record isnt open all the while

or
b) get the users to enter the notes in wordpad/word etc and save those files - then give them a mechanism to pick a file for the given course/assignment - so that instead of storing the notes, you store just the path to the stored notes

if the notes are not going to exceed 64000 chars, i would tend to use the former method

but these methods still dont prevent them losing everything if they have a problem during the entry phase - and I am sure they are familiar with saving their work while using other apps

----------------
as already pointed out, if they type notes in directly they can save them at any time by clicking the pencil icon in the record selector bar.

they will only lose notes once - then they will remember what they needed to do

i think that as a developer you can provide a user friendly interface, but you cant think for people - committing writes automatically is a bit more problematic in access, because an undo button wont undo committed saves (unlike word/excel and most other programmes) - i am sure if you do implement a timed autosave feature you will THEN get users saying - I didnt want those notes saving - how can I return to the original notes
 
What about a saverecord action on the Timer event
 
I agree that providing a save button (the pencil icon is completely counterintuitive to most people) is probably the best way, as Access' autosaving is actually unusual to people with more experience in the other parts of MS Office.

This save-on-a-timer scheme is helpful in some ways but probably more problematic than it's worth.
 

Users who are viewing this thread

Back
Top Bottom