Go Back   Access World Forums > Microsoft Access Discussion > Forms

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 06-30-2011, 11:51 AM   #1
JayJay00
Newly Registered User
 
Join Date: Jun 2011
Posts: 40
Thanks: 6
Thanked 5 Times in 5 Posts
JayJay00 will become famous soon enough
Prevent Next record button from saving previous

Is there a way that i can when switching from one record to another on a form to prevent it from saving the previous record.

The problem comes when i have a check box for each record. The form is based on a query that only shows those that are unchecked. So once checked and moved on to the next record. Im guessing the form still shows the record as it hasn't been closed but doesn't allow you to edit it.

So i want it to not save on changing records so that IF a mistake was made on the form. They could uncheck it after changing records

If that makes sense

Thanks


Last edited by JayJay00; 06-30-2011 at 12:56 PM.
JayJay00 is offline   Reply With Quote
Old 06-30-2011, 12:56 PM   #2
JayJay00
Newly Registered User
 
Join Date: Jun 2011
Posts: 40
Thanks: 6
Thanked 5 Times in 5 Posts
JayJay00 will become famous soon enough
Re: Prevent Next record button from saving previous

Anyone have an idea?
JayJay00 is offline   Reply With Quote
Old 06-30-2011, 01:13 PM   #3
boblarson
Smeghead
 
boblarson's Avatar
 
Join Date: Jan 2001
Location: Oregon, USA
Posts: 32,068
Thanks: 97
Thanked 1,827 Times in 1,578 Posts
boblarson is a splendid one to behold boblarson is a splendid one to behold boblarson is a splendid one to behold boblarson is a splendid one to behold boblarson is a splendid one to behold boblarson is a splendid one to behold boblarson is a splendid one to behold
Re: Prevent Next record button from saving previous

Why won't it let it be edited? It should be able to be unless you have it set in the Form's On Current event to set Allow Edits to false when it isn't a new record.

__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
boblarson is offline   Reply With Quote
Old 06-30-2011, 01:16 PM   #4
spikepl
Eledittingent Beliped
 
spikepl's Avatar
 
Join Date: Nov 2010
Location: San Serriffe
Posts: 6,144
Thanks: 77
Thanked 980 Times in 958 Posts
spikepl is a jewel in the rough spikepl is a jewel in the rough spikepl is a jewel in the rough
Re: Prevent Next record button from saving previous

Yeah. The concept in Access is that a record is saved automagically if a). there were any changes, and b). you for any reason leave the record or form. The way to deal with this is NOT to save a faulty record and then rectify it, but to do whatever checks are necessary in the BeforeUpdate event of the form, and Cancel the update. But, this still leaves you with a changed record. To be able to "escape" from it, the BeforeUpdate event must also undo any changes, which is pretty easy using Me.Undo. First then can you leave the record without it getting saved.

Search for BeforeUpdate in the forum - there are plenty of cases
spikepl is offline   Reply With Quote
Old 06-30-2011, 01:37 PM   #5
JayJay00
Newly Registered User
 
Join Date: Jun 2011
Posts: 40
Thanks: 6
Thanked 5 Times in 5 Posts
JayJay00 will become famous soon enough
Re: Prevent Next record button from saving previous

I have the following code on the check box to remove stock when the ink/toner request is ticked off as 'Done'

Quote:
Private Sub Done_AfterUpdate()


If Me.Done.Value = True Then
If [Current Stock] <= 0 Then

[Current Stock] = MsgBox("No stock available", vbOKOnly)
Me.Done.Value = 0
Else
End If
Me.Current_Stock.Value = [Current Stock] - 1
Else
DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer70
End If
End Sub
Could the 'Undo' part be causing the issue?

Its there so that if someone accidently ticks a job then they can untick it and the stock be put back up.

I tried it with the adding 1 to stock if it was unticked but then you could add stock when the stock level was '0' so it would throw the stock figures out.

Its only a minor issue we had after putting it out on the network today. Its the only one its had and its nothing major.. just want my system to have 0 flaws

JayJay00 is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Prevent saving record if no details in subform sv89 Forms 6 02-21-2011 09:07 AM
How to prevent forms saving empty record lines Kristaline Forms 1 04-02-2009 07:50 AM
Prevent user from saving a record in if statement dealwi8me Modules & VBA 4 07-04-2008 08:09 AM
Prevent Next Record button from opening new record mhughey Forms 3 04-26-2006 09:10 AM
How to undo or prevent a record save from a cancel button? Jovalle Modules & VBA 3 05-18-2000 07:34 PM




All times are GMT -8. The time now is 08:27 PM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World