Hello all,
i have a continuous form that displays about 1000 records and opens when I click a button. When the form opens, the user has the option of checking a checkbox that is located beside each record. The checkbox is labeled "Move" (for moving multiple records at a time to another year). Of course, the checkbox is set as a control "moveRecord " on a table that the query is pulling from. So if the user checks one record, then clicks to another record and checks it as well, the first record is automatically saved. If the user decides to check 10 or 20 records, then decides, "OOPS, i may have made some mistakes, i want to cancel!"
i run into a problem....
I have a button on the form that says "cancel." However, if the user clicks that button, the only record that cancels is the last checkbox that was checked. I want all of the checkboxes to disappear when the user opens up the same form again. As it stands right now, the 19 or so other checkboxes still remain as saved into the table.
Please help! Thank you in advance!
I've tried multiple things even the ON DIRTY execute...here' s what I have now - Private Sub cmdCancel_Click()
-
On Error GoTo errHandle
-
Dim intProcced As Integer
-
-
'Warn the user that any information entered will be lost, then if the user responds that it is
-
'ok, erase the record and close the form
-
-
intProcced = MsgBox("Warning: Any changes made or any information entered will not be saved.", vbOKCancel, "Warning")
-
If intProcced = 2 Then
-
Exit Sub
-
End If
-
-
DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer1X
-
-
DoCmd.Close
-
-
Exit Sub
-
-
errHandle:
-
If Err.Number = 2046 Then
-
DoCmd.Close
-
Exit Sub
-
Else
-
'Print the error message and send an email to Administrator
-
SendErrorMsg "cmdCancel_Click on frmEnterNewFeeder", Err.Number, Err.Description
-
MsgBox Err.Description
-
End If
-
Exit Sub
-
-
End Sub
8 4767 Rabbit 12,516
Recognized Expert Moderator MVP
Please do not double post your questions, your other thread will be deleted.
Rabbit 12,516
Recognized Expert Moderator MVP
Once you change records, it is automatically saved and the changes are committed and can not be undone. You have two options. One is to not use a dynaset and save the entire recordset's changes when needed. This I do not recommend, too many complications. The second is to run an update query that sets all the checkboxes to false if they click cancel.
Please do not double post your questions, your other thread will be deleted.
It's not a double post, read it all the way through before making comments.
Hey thanks for your tip Rabbit...
I modified my code to look like this.... - Private Sub cmdCancel_Click()
-
On Error GoTo errHandle
-
-
Dim intProcced As Integer
-
-
'Warn the user that any information entered will be lost, then if the user responds that it is
-
'ok, erase the record and close the form
-
-
intProcced = MsgBox("Warning: Any changes made or any information entered will not be saved.", vbOKCancel, "Warning")
-
If intProcced = 2 Then
-
Exit Sub
-
End If
-
-
If Me.Dirty = True Then
-
DoCmd.SetWarnings False
-
DoCmd.OpenQuery "qryMoveFeedersFalse"
-
DoCmd.SetWarnings True
-
DoCmd.Close
-
Exit Sub
-
Else
-
DoCmd.SetWarnings False
-
DoCmd.OpenQuery "qryMoveFeedersFalse"
-
DoCmd.SetWarnings True
-
DoCmd.Close
-
Exit Sub
-
End If
-
-
errHandle:
-
If Err.Number = 2046 Then
-
DoCmd.Close
-
Exit Sub
-
Else
-
'Print the error message and send an email to Administrator
-
SendErrorMsg "cmdCancel_Click on frmEnterNewFeeder", Err.Number, Err.Description
-
MsgBox Err.Description
-
End If
-
-
Exit Sub
-
-
End Sub
Rabbit 12,516
Recognized Expert Moderator MVP
It's not a double post, read it all the way through before making comments.
The only difference I saw was you figured out that once you change records, it is automatically saved and the changes are committed and can not be undone.
Rabbit 12,516
Recognized Expert Moderator MVP
This part is redundant. There's no need to check for Dirty. - Private Sub cmdCancel_Click()
-
If Me.Dirty = True Then
-
DoCmd.SetWarnings False
-
DoCmd.OpenQuery "qryMoveFeedersFalse"
-
DoCmd.SetWarnings True
-
DoCmd.Close
-
Exit Sub
-
Else
-
DoCmd.SetWarnings False
-
DoCmd.OpenQuery "qryMoveFeedersFalse"
-
DoCmd.SetWarnings True
-
DoCmd.Close
-
Exit Sub
-
End If
-
This part is redundant. There's no need to check for Dirty. - Private Sub cmdCancel_Click()
-
If Me.Dirty = True Then
-
DoCmd.SetWarnings False
-
DoCmd.OpenQuery "qryMoveFeedersFalse"
-
DoCmd.SetWarnings True
-
DoCmd.Close
-
Exit Sub
-
Else
-
DoCmd.SetWarnings False
-
DoCmd.OpenQuery "qryMoveFeedersFalse"
-
DoCmd.SetWarnings True
-
DoCmd.Close
-
Exit Sub
-
End If
-
What is the person opens the form, makes NO changes and then clicks cancel.
Rabbit 12,516
Recognized Expert Moderator MVP
What is the person opens the form, makes NO changes and then clicks cancel.
Well, the thing is that the query runs no matter what happens. If they make no changes and click cancel, it unchecks all the boxes. If they make a change and click cancel, it unchecks all the boxes. So either way, it unchecks all the boxes.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Corrine |
last post by:
Is there a way to cancel a change in an option group? The option group still
changes to the option clicked on when clicking on the NO button with the
following code in the BeforeUpdate event of the option group.
If MsgBox("Change?", vbYesNo) = vbNo Then
Cancel = True
Me!MyOptionGroupName.Undo
End If
I also tried reversing the Cancel and...
|
by: Deano |
last post by:
Alot of my forms are bound.
I would like to offer a Cancel option so that they can make as many changes
as they like and still Cancel out without making any changes.
I have one idea of how to do this for new records; tag each record with a
boolean value. On clicking OK, these are all set to True and the form
closes.
If they Cancel the...
|
by: allyn44 |
last post by:
HI--what I am trying to do is 2 things:
1. Open a form in either data entry mode or edit mode depending on
what task the user is performing
2. Cancel events tied to fields on the form if I am in edit mode.
The reason I want to do this is becasue when entering a new record the
form is entered in data entry mode and I have lots of stuff...
|
by: Raji16 |
last post by:
Hi,
I am a new member. i am designing a simple judicial database system. however after creating tables i am a bit confused on setting the relationships between tables :confused: here is the link of a snapshot of my table design and i wud highly appreciate if anyone cud help me on building the table relationships. Link:...
|
by: Richard |
last post by:
A shipment of material is received.
The shipment contains several items.
Each item is assigned an internal tracking number for auditing
purposes and further processed.
The tracking number is mandatory, unique and non-zero, but _cannot_ be
obtained or assigned automatically by Access (due to business rules
).
Table A is the receive table...
| |
by: martin |
last post by:
Hello,
Is there a way to make a kind of "cancel" button on a form?
Suppose you accidently changed or overwrote some data in a form, then I'd
like to leave this form at once and cancel any change made in this form.
Hopefully someone has a clue for me.
thanks a lot!
|
by: Matuag |
last post by:
Hi All,
I want to create following command buttons on a Form which users can
edit.
Save ( Save Changes made)
Cancel ( Undo data changes)
Exit ( Close form)
I am using Macros for each of these commands and they work perfect.
|
by: inadsad |
last post by:
Greetings Group:
I got a form with multiple controls that are bound to a dataset, with
two buttons & next/previous. Simply, add button adds a new record and
cancel button undo changes.
On add click event button:
Me.BindingContext(ds1.Tables("MyTable")).EndCurrentEdit()
Me.BindingContext(ds1.Tables("MyTable ")).AddNew()
On Cancel
|
by: jmarcrum |
last post by:
Hey everybody!
I've created 2 buttons that I've placed on all my forms: a Save button & a Cancel button.
The cancel button I have a question about.
I used the wizard to create the button and I selected the Record Operations/Undo Record option. I edited the vba code to have the button also close the form after it undoes any changes. ...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |