Saving Records

M

mon

Hi Again, I am finding that it is too easy to accidently
enter a record. How do I make a save Button so that it
has to be actioned before the record is saved.
Thanks Mon
 
R

Ron

Mon,
Set the Form Properties "AllowAdditions" to "No".
In the button Click event code:
Me.AllowAdditions = True
Either in the From Current event or the Form AfterUpdate
event you can reset the property by coding:
Me.AllowAdditions = False

OR

In the Form BeforeUpdate event you can code a "MsgBox" and
ask "Do you know your adding another record, Stupid???".
You can then set the BeforeUpdate "Cancel" argument
to "False" to inhibit the saving to the data.

Ron
 
J

John Vinson

Hi Again, I am finding that it is too easy to accidently
enter a record. How do I make a save Button so that it
has to be actioned before the record is saved.
Thanks Mon

You can do this with a little VBA code. Define a global variable by
putting

Public bOKToSave As Boolean

in the Form's Module, at the top before any Sub lines. Set bOKToSave
to False in the Form's Current event; to True in the Save button code;
and in the Form's BeforeUpdate event put

If bOKToSave Then
MsgBox "Please use the Save to save the record", vbOKOnly
End If
 
M

mon

Non of this is working for me (Sorry)
-----Original Message-----
Mon,
Set the Form Properties "AllowAdditions" to "No".
In the button Click event code:
Me.AllowAdditions = True
Either in the From Current event or the Form AfterUpdate
event you can reset the property by coding:
Me.AllowAdditions = False
###I've done all this (thank you for the code), but all I get is a totally blank form.
OR

In the Form BeforeUpdate event you can code a "MsgBox" and
ask "Do you know your adding another record, Stupid???".
You can then set the BeforeUpdate "Cancel" argument
to "False" to inhibit the saving to the data.
#### What is the code for Cancel argument?
Thanks Mon
 
M

mon

Thanks for your help
Absolutely nothing is working for me
Now the Public goes into the General section
(Declearation)?
Public bOKToSave As Boolean
Is "Me.bOKToSave = False" the correct statement?
 
J

John Vinson

Thanks for your help
Absolutely nothing is working for me
Now the Public goes into the General section
(Declearation)?

Please post the actual code that you are using.
 

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