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 4742
Please do not double post your questions, your other thread will be deleted.
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
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.
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.
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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,...
|
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...
|
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...
|
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...
|
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,...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
| |