Disable autosave (again)? (1 Viewer)

howieh

New member
Local time
Today, 04:44
Joined
Jul 11, 2011
Messages
6
Hi, I know there are quite a few posts on the forum already about how to disable autosave in access. But I am an absolute noob in Access and still have no idea how to disable autosave after reading all the threads... Can someone post a detailed, step by step guide on how to do this?

Much appreciated!
 

missinglinq

AWF VIP
Local time
Today, 07:44
Joined
Jun 20, 2003
Messages
6,423
You're trying to reinvent the way Access is intended to work, and this becomes a problem with experienced Access data input users. They know that Access saves records when moving to another record or when the form is closed, and expect this behavior. In my opinion, it's a better policy to allow Access to work in its native way and merely check with the user before the record is saved, allowing them to save it or dump the new record or changes. This piece of code will do just that
Code:
Private Sub Form_BeforeUpdate(Cancel As Integer)
If Not (Me.NewRecord) Then
 If MsgBox("Would You Like To Save The Changes To This Record?", vbQuestion + vbYesNo + vbDefaultButton1, "Save Changes to Record ???") = vbNo Then
  Me.Undo
 End If
Else
 If MsgBox("Would You Like To Save This New Record?", vbQuestion + vbYesNo + vbDefaultButton1, "Save This Record ???") = vbNo Then
  Me.Undo
 End If
End If
End Sub
Linq ;0)>
 

howieh

New member
Local time
Today, 04:44
Joined
Jul 11, 2011
Messages
6
You're trying to reinvent the way Access is intended to work, and this becomes a problem with experienced Access data input users. They know that Access saves records when moving to another record or when the form is closed, and expect this behavior. In my opinion, it's a better policy to allow Access to work in its native way and merely check with the user before the record is saved, allowing them to save it or dump the new record or changes. This piece of code will do just that
Code:
Private Sub Form_BeforeUpdate(Cancel As Integer)
If Not (Me.NewRecord) Then
 If MsgBox("Would You Like To Save The Changes To This Record?", vbQuestion + vbYesNo + vbDefaultButton1, "Save Changes to Record ???") = vbNo Then
  Me.Undo
 End If
Else
 If MsgBox("Would You Like To Save This New Record?", vbQuestion + vbYesNo + vbDefaultButton1, "Save This Record ???") = vbNo Then
  Me.Undo
 End If
End If
End Sub
Linq ;0)>

Thanks missinglinq,

This is indeed the tweek that I intended to ask. However, where exactly do I input the code? Sorry I am totally new to Access...
 

missinglinq

AWF VIP
Local time
Today, 07:44
Joined
Jun 20, 2003
Messages
6,423
You don't say what version of Access you're using, but in Versions 2003 and older
  • Copy the code I posted
  • From Form Design View Press <Ctrl> + <G>
  • You're now at the Code Module for the Form
  • Beneath current code, if any, Paste the code in
  • Save the File
  • Back out of the Code Module
If you're using Versions 2007/2010, make sure that your File is in a 'Trusted" location. You have to do this, in these versions, in order for Code to run.

You should be set. If you have any problems, post back.

Welcome to AWF and good luck with your project!

Linq ;0)>
 

howieh

New member
Local time
Today, 04:44
Joined
Jul 11, 2011
Messages
6
You don't say what version of Access you're using, but in Versions 2003 and older
  • Copy the code I posted
  • From Form Design View Press <Ctrl> + <G>
  • You're now at the Code Module for the Form
  • Beneath current code, if any, Paste the code in
  • Save the File
  • Back out of the Code Module
If you're using Versions 2007/2010, make sure that your File is in a 'Trusted" location. You have to do this, in these versions, in order for Code to run.

You should be set. If you have any problems, post back.

Welcome to AWF and good luck with your project!

Linq ;0)>

Hi, thanks again.

I have 2002 and I went to the design view of the form, pressed ctrl+G, it looks like I entered Visual Basic and the cursor is at "Immediate" window. And where do I insert code/module? Is the "immediate" window the Code window?
 

missinglinq

AWF VIP
Local time
Today, 07:44
Joined
Jun 20, 2003
Messages
6,423
No, teh Immediate Window, in the Code Module, is for 'immediately testing code.' Either just close that window, with the X in the upper, right-hand corner of the small window, or click into the white space above it and below the line Option Compare Database.

Paste the code in there.

Linq ;0)>
 

howieh

New member
Local time
Today, 04:44
Joined
Jul 11, 2011
Messages
6
No, teh Immediate Window, in the Code Module, is for 'immediately testing code.' Either just close that window, with the X in the upper, right-hand corner of the small window, or click into the white space above it and below the line Option Compare Database.

Paste the code in there.

Linq ;0)>

"option compare database" as in "Module"? I pasted the code underneath "option compare database" and saved the module, however Access still doesn't prompt me with any warning after I make changes and close the program...:confused:
 

missinglinq

AWF VIP
Local time
Today, 07:44
Joined
Jun 20, 2003
Messages
6,423
"option compare database" as in "Module"? I pasted the code underneath "option compare database" and saved the module
If you've pasted the code into a Module by going into the Objects Dialog Box, where you see, down the left-hand side

Tables
Queries
Forms
Reports
Pages
Macros
Modules


and then selecting Modules and Create, you've created a Standard Module! You can still see the Immediate Window, from here, and you'll see Option Compare Database, as well, but you're in the wrong place!

The code needs to be in the Form's Code Module.

When you have the code that you've pasted in, staring you right in the face, and you look up at the at the very top of the module window, to the left, do you see something like

Code:
Microsoft Visual Basic DB_Name [B]Module[/B]Name (Code)
or

Code:
Microsoft Visual Basic DB_Name [B]Form[/B]Name (Code)

And I guess you might as well copy and post your exact code here.

Linq ;0)>
 

howieh

New member
Local time
Today, 04:44
Joined
Jul 11, 2011
Messages
6
If you've pasted the code into a Module by going into the Objects Dialog Box, where you see, down the left-hand side

Tables
Queries
Forms
Reports
Pages
Macros
Modules


and then selecting Modules and Create, you've created a Standard Module! You can still see the Immediate Window, from here, and you'll see Option Compare Database, as well, but you're in the wrong place!

The code needs to be in the Form's Code Module.

When you have the code that you've pasted in, staring you right in the face, and you look up at the at the very top of the module window, to the left, do you see something like

Code:
Microsoft Visual Basic DB_Name [B]Module[/B]Name (Code)
or

Code:
Microsoft Visual Basic DB_Name [B]Form[/B]Name (Code)
And I guess you might as well copy and post your exact code here.

Linq ;0)>

I have
Code:
Inventory-Howie - Module1 (Code)
......I guess I need to open an window with something like "Form1" instead of "Module1"?
 
Last edited:

missinglinq

AWF VIP
Local time
Today, 07:44
Joined
Jun 20, 2003
Messages
6,423
That's the instructions I posted before!

From Form Design View of the Form in question, Press <Ctrl> + <G>. You should now be in the Code Module for that Form.

Click into the window, directly below

Option Compare Database

Paste the code in from Post #2, above, and you should be done!

Linq ;0)>
 

howieh

New member
Local time
Today, 04:44
Joined
Jul 11, 2011
Messages
6
Sorry I still don't get it....

Take a look at this and see if I'm in the right place?
 

Attachments

  • 15-07-2011 12-30-21 PM.jpg
    15-07-2011 12-30-21 PM.jpg
    89.5 KB · Views: 603

rashu248

Registered User.
Local time
Today, 15:44
Joined
Nov 7, 2016
Messages
10
Thanks and really useful this.
here i have one request. how to save multiple record at a time.?
For eg:-
Table: tblMaterials
Form: FrmMaterials (Datasheet mode with data entry)
if i entry more than one record by using your VBA, its asking for save on each time,
Therefore i need to avoid such disturbance while entering more data s

Please help me??
 

Attachments

  • AutoSave.png
    AutoSave.png
    36.9 KB · Views: 175

JHB

Have been here a while
Local time
Today, 12:44
Joined
Jun 17, 2012
Messages
7,732
...its asking for save on each time,
Therefore i need to avoid such disturbance while entering more data s
..
Could you please describe exactly what you want!
 

JHB

Have been here a while
Local time
Today, 12:44
Joined
Jun 17, 2012
Messages
7,732
I think that's it - Galaxiom. :)
 

rashu248

Registered User.
Local time
Today, 15:44
Joined
Nov 7, 2016
Messages
10
Dear Mr. JHB
First of all thanks for your grand support.

I make one multiple entry forms for creating new materials in the database
When I am entering more than one records in this form by using below VBA code, Its appearing save messages on updating each rows.

Here I want to know how to save all records at one time with Click on Save button, shown as attachment

Please help me and Kindly see the attachment.


Private Sub Form_BeforeUpdate(Cancel As Integer)
If Not (Me.NewRecord) Then
If MsgBox("Would You Like To Save The Changes To This Record?", vbQuestion + vbYesNo + vbDefaultButton1, "Save Changes to Record ???") = vbNo Then
Me.Undo
End If
Else
If MsgBox("Would You Like To Save This New Record?", vbQuestion + vbYesNo + vbDefaultButton1, "Save This Record ???") = vbNo Then
Me.Undo
End If
End If
End Sub
 

Attachments

  • AutoSave1.png
    AutoSave1.png
    21.2 KB · Views: 135

JHB

Have been here a while
Local time
Today, 12:44
Joined
Jun 17, 2012
Messages
7,732
Look at the post #14 from Galaxiom, I think the database he created in the other thread he linked to, is 100% matching your requirements.
 

rashu248

Registered User.
Local time
Today, 15:44
Joined
Nov 7, 2016
Messages
10
Ok dear,
I got that, that is the really one what i need..

I am really appreciate both of you for very prompt response and kind support.

now i am working on this, if need any further queries i will disturb you again:):):):). pls don't be....<><>
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 11:44
Joined
Sep 12, 2006
Messages
15,613
seriously.

if you are new to access, I would avoid trying to add unnecessary stuff like this, and gain an understanding of what access actually DOES DO.

then you can decide whether you want or need to implement solutions of this nature.

And by the way. Adding a message to confirm the save of every record change will be something you decide to turn off very very quickly.

I can't think I have ever tried to disable the autosave feature of a form.

If I needed to do something like that, I would probably use an unbound form, because that would most likely fit the circumstances.


and now I see this is an old thread that got resurrected somehow ...
 

rashu248

Registered User.
Local time
Today, 15:44
Joined
Nov 7, 2016
Messages
10
Dear, gemma-the-husky
Don't think deeply pls..
Its working for me very fine.

Dear Galaxiom,
I have some doubts that i will ask later


Please feel free to avoid if need be, Thanks
 

Users who are viewing this thread

Top Bottom