By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,456 Members | 1,251 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,456 IT Pros & Developers. It's quick & easy.

close form macro

P: n/a
I have two questions here:
(1) what is the difference of close form and close table?
(2) How "Prompt" works
I used close form macro in my database. I hope when a user close the
form, he/she will be asked if he/she wants to save the form (actually,
I hope the user could decide if he or she want to add the new data to a
database). I chose "prompt" in "Save" option of close macro. But there
is no difference if I chose "yes" in "save" option. Anyone knows the
difference? Thanks.

Mindy

Dec 28 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Hi again Mindy,

Access automatically updates and adds data when closing a form. In
order to trap a response from your users you might like to add a bit of
VBA code in the Before Update event section on the form you want to
check. Remember however, that providing prompts to users is a very
useful aspect of UI design, however repetitious prompting can make an
otherwise nice db quite tedious to use (personal thoughts...). You
might simply inform your users that if they don't wish to update the
form's data that they can use the ESC key twice to clear the current
form's data and then close.

If you do want to provide promts something like should do what you
want.

If MsgBox("Do you want to save this record?", vbQuestion + vbYesNo,
"Save") = vbYes Then
DoCmd.Close
Else
MsgBox "If you want to cancel saving this form press the ESC key twice
and then close again.", vbInformation + vbOKOnly, "Information"
DoCmd.CancelEvent
End If

Dec 28 '05 #2

P: n/a
(1) Tables and forms are different types of objects... what are you
trying to do? Closing any kind of object does the same thing - removes
it from memory and all that fun.

Dec 30 '05 #3

P: n/a
I am asking this question because I was confused about the data process
of ACCESS. Form is used to enter data to table, but at what time data
is saved in table, the time we close the form, or the time we enter
data to the field. Considering the safety issue, should we close the
form once we finish entering data? Thanks.

Dec 30 '05 #4

P: n/a
Mindy wrote:
I am asking this question because I was confused about the data
process of ACCESS. Form is used to enter data to table, but at what
time data is saved in table, the time we close the form, or the time
we enter data to the field. Considering the safety issue, should we
close the form once we finish entering data? Thanks.


Normally the record is saved when you leave the record.

That can be from...

Closing the form
Navigating with the navigation buttons
Applying a filter
Removing a filter
Moving focus from main form to subform
Moving focus from subform to main form

You can also save by pressing Shift-Enter or by calling save from the main menu.

You can also have your own save button that uses code...

Me.Dirty = False
or
DoCmd.RunCommand acCmdSaveRecord

--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com
Dec 30 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.