Aaron G said:
Newbie question. I always thought a record was pretty much saved as soon
as
it lost focus.
Well, more specify, when you move to another record, or close the form, the
record is saved. A form loosing focus does not necessary save the record.
After reading though these newsgroups I'm noticing people
using a save record command. What is the purpose?
There is little purpose, except to annoy the users. The problem here is that
many users come from using word, or excel, and you have to SAVE the data
when you are done. So, when those people come to ms-access, they are at a
loss as to why no save commend is needed. So, all of a sudden, you got a ton
of people asking for save code when they DO NOT NEED any at all.
Worse, is these save prompts are usually VERY VERY VERY annoying. For
example, can you imagine if you turn the key in your car, and then the car
pop up a message saying:
do you want to start the car?
How about the save concept:
You open a file cabinet, put a document into it, and the file
cabinet says do you really want to file the document?
This is sheer nuts, and is just pure annoyance by amateurs developers that
seek to annoy users, and just cause them pain.
Successful commercial products like palm pilots,a nd applications like
ms-access DO NOT annoy the users with a save prompts.
When you use outlook express, and hit the send button, a copy of the email
is actually saved in the outbox...but are you prompted for a save? (no). So,
ms-access got this right more then 10 years ago.
The fact of the matter is, that users ACTIONS should tell the software what
to do. I mean, why on earth is a user trying to move to the next record
without saving the current record? (answer: of course the user wants the
record saved...why else would they move on?). So, save the record for
them...(if they don't want to save changes..then go edit->undo).
So, as rule, you don't have to worry. The many people asking for "save" code
are simply people who need to annoy the end user with a annoying save
prompts OVER AN OVER AND OVER all day long.
The fact is, ms-access got it right..and you got it right also.....(that
being that things should get saved automatically).
Using code to save a record is often a different issue then all the
questions about save prompts, and I don't want you to get confused here. So,
99% of those questions are people who want to annoy people.
There is certainly times when you want to force a record save, but again no
prompts need occur. For example, we OFTEN get the question in this newsgroup
on how to print the ONE record you are viewing to a report. The code to do
this often given is:
docmd.OpenReport "myReport",,,"id = " & me!id
In fact, the above code is not 100% good, since the one record you are
editing has NOT been saved to disk,a nd the report will NOT show you
changes. So, the above should be written as:
me.Refresh
docmd.OpenReport "myReport",,,"id = " & me!id
In fact, in place of me.refresh, most point out it is better to use
if me.Dirty = true then
me.Dirty = false
end if
docmd.OpenReport "myReport",,,"id = " & me!id
So, there are some times when you most certainly want to force a data
save..but keep that concept from the many zillions of people who come and
ask for silly save prompts to make life annoying....