General :: Undo Changes Made To A Form?
Jul 23, 2012
It has really been awhile I posted in this forum
I have a form purchase order details, that I used to enter quantity of items purchased. I found out that I can't delete quantities entered on the form. It appears to delete, but on checking the quantity in the inventory, it was not deleted. The vba code in my quantity section of the page is this
Quantity_AfterUpdate()
Dim IT As InventoryTransaction
If Me![Quantity] = 0 Then
RemoveCurrentLineItem
End If
AddPurchase Me![Purchase Order ID], Me![Item ID], Me![Quantity], NewInventoryID
End Sub
View Replies
ADVERTISEMENT
Jul 26, 2007
Hi, i am stumped.
I have two tables Tbl_Referrals and Tbl_CMSData. Both of these tables have an identifier in called ConflictID. I have created a query which selects the records from both tables where the conflict ID is the same.
I have a form running this query. Down one side of the form i have all the details from Tbl_CMSData and on the otherside of the Form i have the corresponding details from Tbl_Referrals. I need the user to be able to update field by field from Tbl_CMSData to TblReferrals. This is done by means of a simple update query for each field. This all works fine.
Problem - I need an undo button for each field. Me.Undo does not work becuase the changes have been made by a query and not on the form.
Is there a way of undoing what the query has updated? Possibly by setting the focus to a Tbl_Referrals and then undoing the changes?
Thanks in advance
View 5 Replies
View Related
Jul 9, 2013
When I had a subform (continous form) I had a code which check, that record was used in other form, if yes, then code not allowed to delete this record, if not, record was deleted. But now I have a datasheet form, and the question is, What should I do, to have the same results what I had in continous form.
Now it doesn't matter that I past this code in "Before Del Confirm", "On delete", "After Del Confirm", this code doesn't work in this view of form. Always if I click (right button) on record, then i choose "delete record" MS Access delete my record without checking that was used in other form or not.
Code:
If Not IsNull(DLookup("Id_Gora_Zlecenia.Value", "TblDolZlecenia", "Id_Gora_Zlecenia.Value=" & ID_gora_zlecenia)) Then
MsgBox "You can't delete this record because it is used in another form"
Exit Sub
End If
DeleteRecord Me
End Sub
DeleteRecord:
Code:
Public Function DeleteRecord(ByRef f As Form) As Boolean
DeleteRecord = False
On Error Resume Next
DoCmd.SetWarnings False
If Not f.NewRecord Then
DoCmd.RunCommand acCmdDeleteRecord
[Code] .....
View 14 Replies
View Related
Dec 8, 2012
i want to have a button where the operator can cancel when on a current record. i want an if. if form has changes made but not saved then undo else close.
is the record state 'dirty'?
View 2 Replies
View Related
Sep 27, 2012
I've got a database that allows all users to review an address register. If they find errors or mostly get updated information they have another form they can fill out to make the recommended changes. Only I have access to the main DB to make the change permanent.
The question I have is there a way for Access to send me a notification that someone has requested the change?
I know that sending an email is doable - in Access. However, that's not an option for our network here. I was thinking something along the command prompt "Net Send" command. However I've not been able to get that to work by itself - let alone within Access...
I have used VB code in the past to store what PC is using the database, I could modify that to alert me whenever I open the DB up from my PC. But I was trying to get away from having to open this particular DB up every day and check for changes.
View 2 Replies
View Related
Aug 7, 2014
I have been trying to set up a batch file to allow users to copy the latest version of the front end whenever a change is made. The following is the code that I am trying to get to work properly. The first part works fine, the old front end is copied to a folder on the user's desktop as a backup. But I cannot get the copy of the server - the "P" drive, to overwrite the current copy on the user's desktop. Actually I cannot get the code to copy the new front end from the server and install it on the user's desktop. I think the path is correct for I seem to be able to run the new front end from the server.
When I look for the location on my computer, the server locations is listed as:
General (Servernamefiles) (P: ) (there is no space after the P: it seems to result in a smiley face when I type it and try to post it).
for /f "tokens=2-4 delims=/ " %%a in ('date /T') do set year=%%c
for /f "tokens=2-4 delims=/ " %%a in ('date /T') do set month=%%a
for /f "tokens=2-4 delims=/ " %%a in ('date /T') do set day=%%b
set TODAY=%year%-%month%-%day%
rem echo %TODAY%
[Code] .....
This code works so I thought that the path was correct
rem this works
rem start the new DB front end
Start P:AccessMainSplitBENewFrontEndDBMain.accdb
But this code does not.
echo f | xcopy /f/y/ P:AccessMainSplitBENewFrontEndDBMain.accdb c:UsersUserNameDesktopDBMain.accdb
Neither does this:
echo f | xcopy /f/y/ ServerNamefilesP:AccessMainSplitBENewFrontEn dDBMain.accdb c:UsersUserNameDesktopDBMain.accdb
View 2 Replies
View Related
May 4, 2006
I have a Memo box where the user puts comments and then I have a check box that if check automatically puts a specific phrase on the first line of the Memo box (before any other text currently in the box). What I am trying to do is have it so that if the "check box" is UN-checked it will remove the line that it just added to the Memo box. I have been able to get it to undo everything in the Memo box, but what I really need is for it to just undo the last line of text that was enterd when the user checked the box.
Example:
Memo Box:
This is the line that the checkbox just added when the checkbox is set to "True"
This is the test data the user has already put in the box...
==================
User now UN-checks the checkbox (I want the Memo box to read.. see below) Thereby deleting the line "This is the line that the checkbox just added when the checkbox is set to "True""
Memo Box:
This is the test data the user has already put in the box...
How can I accomplish this?
View 1 Replies
View Related
Nov 14, 2006
Hi, I have found the answer to most of my problem, thanks to previous posts.
I am using the Undo command on a Date field. However it seems that my code is maybe not staying on the event to action the undo.
After it runs the Focus goes to the next field Me.LeaveDays and the value is automatically entered, unless I comment back in the Goto's in which case the value will be zero.
I want to be able to Undo the EndDate (and preferable the StartDate, and Setfocus to StartDate) EndDate will do if not possible.
Don't want to Undo the whole form, although that could be a last resort.
My code is in the before_update event, image posted (ignore faded fields, not visible/needed in final solution)
Private Sub EndDate_BeforeUpdate(Cancel As Integer)
On Error GoTo Err_EndDate_BeforeUpdate
Dim intLeaveLeftAL As Integer
Dim intLeaveLeftSL As Integer
Dim intLeaveDays As Integer
Dim dtNullDate As Date
Dim varNullField As Variant
intLeaveLeftAL = Nz(Forms!frmAddLeaveRecords.fsubLeaveAgTots.Form![DailyALInc] - (Forms!frmAddLeaveRecords.fsubLeaveAgTots.Form![ALDays] - Forms!frmAddLeaveRecords.fsubLeaveAgTots.Form![ACDays]), 0)
intLeaveLeftSL = Nz(10 - Forms!frmAddLeaveRecords.fsubLeaveAgTots.Form![SLDays], 0)
' Use the WorkingDays function to calc the number of Leave Days
' set LeaveDays and requery the form
intLeaveDays = WorkingDays(Me.StartDate, Me.EndDate)
If Me.LCode = "LC41" Then ' Sick Leave
Select Case intLeaveDays
Case Is > intLeaveLeftSL
MsgBox "Employee does not have enough Leave" & vbCrLf & "to take as Sick Leave.", vbCritical + vbOKOnly + vbDefaultButton1, "Entry in Error"
varErrorCondition = True
Me.EndDate.Undo
GoTo Exit_EndDate_BeforeUpdate
Case Else:
End Select
ElseIf Me.LCode = "LC11" Or Me.LCode = "LC13c" Then ' Annual or C/Fwd Leave
Select Case intLeaveDays
Case Is > intLeaveLeftAL
MsgBox "Employee does not have enough Leave" & vbCrLf & "to take as Annual Leave.", vbCritical + vbOKOnly + vbDefaultButton1, "Entry in Error"
varErrorCondition = True
Me.EndDate.Undo
GoTo Exit_EndDate_BeforeUpdate
Case Else:
End Select
End If
Me.LeaveDays = intLeaveDays
Me.LeaveDays.Requery
varErrorCondition = False
Exit_EndDate_BeforeUpdate:
Exit Sub
Err_EndDate_BeforeUpdate:
MsgBox Err.Number & " - " & Err.Description
Resume Exit_EndDate_BeforeUpdate
End Sub
The ifs and cases work fine, just like to send the User back a few steps
appreciated :) :)
View 9 Replies
View Related
Sep 25, 2013
I have some forms where I can cancel my input. However this works only on the current record. When I implement a subform this does not work anymore. Because access auto saves when focus is set to the subform.
I don't wan't to use unbound forms. What I would like to do is when I press EDIT that a snapshot or something is taken of the current values. So I can set them back.
I can use variables for the main form, but I don't know how to save the values of the records of the subform.
Or does the possibility exist to use transactions?
I just want to be able to undo all changes regardless of the subforms.
View 3 Replies
View Related
Jul 14, 2014
I need to program vba to "Undo" only one field on a form, not the entire form. The user enters a number of fields and then tabs to a text field which allows them to enter an 8 digit code. If this code matched one already in the database, I have a message box telling them of the match and offering to either clear the entry or to allow them to go back and edit what they have entered. The 2nd part of this works fine, but I can't figure out how to just clear the text box without clearing the entire form. (the form is bound to a table)
I have tried DoCmd.RunCommand acCmdUndo which clears the entire form.
Me.TextBox.undo does nothing at all.
(a search found several websites that say use Me!TextBox.undo, but that doesn't pass the complier)...
View 14 Replies
View Related
Jun 10, 2005
I was wondering if there is a simple way to check if any changes have been made to a record when the form is closed because I would like to create a log of records that were changed. I'm sure I could create some variables to store the fields when the form is opened then check if they're still the same when the form closes, but I figured there's probably already a built-in way of doing this (since the undo button must obviously use it)
Thanks,
Adam
View 2 Replies
View Related
Jul 12, 2005
I need a special messagebox witch returns integer value to public variable.
now I have made it the problem is how to use it.
In Sub where the messagebox form is opened the Sub should wait until it get the response from messagebox_form. That is because this sub will save it in the table.
So how to get te sub to stop and wait until the public variable is changed
(if I use some kind of loop I can't use the form at the same time)
-thans, Jalmari
View 1 Replies
View Related
Mar 10, 2014
I'm using the following code to ask the user whether to save changes to the data, don't save changes or Cancel the close and continue editing. I'm closing the form using the 'X' only.
Code:
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim UserResp As Integer
UserResp = MsgBox("Record(s) have been added or changed." & vbCrLf & "Save the changes?", vbYesNoCancel)
Select Case UserResp
[Code] ....
The problem I'm having is when I press the 'Cancel' button in the message box. When I press 'Cancel' the form remains open (bPreventClose=True) which is what I want. But the changes to the data get undone even though I don't have Me.Undo in that case.
First, what's causing the undo?
Second, how do I prevent the data from undoing when I press 'Cancel.'
I went to add a record earlier and selected 'Cancel' because I wanted to change one small item. I lost all the data I had put in and had to start over.
View 2 Replies
View Related
Jul 22, 2013
I thought "Undo" was only available while in the current record.Here were my steps:
1 - Loaded form that shows 1 record per form page.
2 - Edited a record
3 - Moved to another record with status bar nav arrow
4 - Verified my edit was in the underlying table
5 - Moved back to the original record, again using status bar nav arrow
6 - Clicked my "undo" control and the original data appeared in the form
7 - Moved to another record
8 - Verified my original data was now back in the underlying table
My undo control has this vba on click:
Code:
DoCmd.RunCommand acCmdUndo
View 1 Replies
View Related
Feb 3, 2015
How come its so hard to create an undo method when using a form and subform, lookup tables and tiered selections in combo boxes?
View 3 Replies
View Related
Mar 8, 2015
I have an Undo button : [btnUndo] and would like it hidden until someone starts to enter data, where it will become visible...
what code would I use? and where would
Code:
me.btnUndo.visible = true
be triggered?
View 3 Replies
View Related
Feb 26, 2014
I created a form for data entry only where records could be continually added until you were done and closed the form. Into that form I dropped a query that kept a running list in datasheet form of all the new records entered while the form was open, and then cleared when the form was closed (so the query was empty when the form was opened again).
My Problem: I accidentally deleted that query.
What I need:
-Query to be empty when form is opened.
-Records added while form is open get displayed in the query after record is saved.
View 1 Replies
View Related
Dec 13, 2014
How to generate either a form or report able to show me the history of data changes made by users in the fields of Access Objects. I'm more interested in Forms, since the users will use Forms to change data in the db.
Let me give an example:
My db has, for instance, a form named Frm1 and a form named Frm2. Both were built including several fields such as text boxes, combo boxes, etc.
So, if the user Paul first changes the field Color of the record Id 235 in the Frm1 from Green to Yellow, and then, down the road George changes the field Size of the record Id 14 in the Frm2 from Big to Small, I need to know what changes were made, by who, and when changes happened. Also, it is important to know if a record Id is added or excluded.
My final intent is to have a report/form that shows some sort of user activity log which I think could be like this:
Date--------Time----------User-----Form------RecId------Action------Field-----From-----------To
Dec12,14---15:12:35-----Paul-----Frm1--------235------Changed---Color----Green-----------Yellow
Dec18,14---07:05:19-----George--Frm2---------14------Changed---Size-----Big--------------Small
Dec22,14---09:23:59-----Sean----Frm2--------116------Deleted
Dec23,14---11:07:03-----Paul-----Frm2--------321------Added
etc...
By sorting this output by date, form and field it will easy to check/audit for user processing mistakes.
I know enough to build tables, queries, forms and reports, but don't know how to structure such thing. What kind of form event should I setup?
View 2 Replies
View Related
Sep 24, 2014
I'm trying to resolve a problem with a form displayed as follows
MainForm
-->SubForm1 embedded in main form
--->SubForm2 embedded in SubForm1
When I edit subform2, then return to the mainform and edit a field on the mainform, I get an error.
'The data has been changed. Another user edited this record.... Re-edit the record.'
My understanding to resolve this is to do a requery. So I added:
Me.Parent.Requery
Me.Parent.Parent.Requery
as part of the LostFocus event for subform2. However, I now get a Write Conflict error when returning to a field in the main form. I get a dialog box with the option to Copy to Clipboard or Drop Changes. I can select Drop Changes and it will let me edit the main form afterwards.
This is Access 2010 over SQL. how to get the main form to accept the changes made to the underlying subform?
View 8 Replies
View Related
Apr 27, 2015
So I'm trying to populate a table based on selections I make within a form.
The form is based of a query that pulls a new product category that needs to be added to my first reference table for products.
The form shows all the new unique product codes, and there is a drop down box with product categories whose source is also the first reference table, so a new code would be:
'JBL - TRX - FVB - TRZ' And based on that new info, I would select from the drop down to select the corresponding category and click 'Add Record' button.
I'm building the event for the button and the code is as follows so far :
Private Sub Add_Record_Click()
End Sub
Private Sub cmbAdd_Record_Click()
'add data to table
CurrentDb.Execute "INSERT INTO tblPVMTable(PVMJoinField, SummaryPVMCategory) " & _
[Code] ....
I keep getting errors with the main portion of code.
Name of table fields :
PVMJoinField
SummaryPVMCategory
Name of Query Fields Populating the Form:
PVM_JOIN_FIELD
cboSummaryPVMCategory
View 4 Replies
View Related
Aug 5, 2005
Hi everyone!!
This is my first thread in this forum..Hope to get best from this site ..well i m facing a problem..i have a main form and a subform (which is in datasheet view) . Now i have a button called "close_form" in main form on whose click event i have writen this code :
Private Sub close_form_Click()
On Error Resume Next
DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer70
Me.Controls.Item("fees sub").SetFocus
DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer70
DoCmd.Close
End Sub
1. If i run this form directly from Access and there are no changes i do in the form and click this button then it gets hang after showing error "run time error 2046 ; the command or action undo is not available now " "press End or Debug or help"
2. As i have created a Custom menu, if i run this form from that menu then it does not show any error. But it runs fine for the first time but nothing happens on clicking this button the second time i open the same form ( in same session).
What to do ?? Please help ..
shikha
View 2 Replies
View Related
Feb 10, 2005
Is there a way to code something that will say do Undo All changes.
I have a button called Exit without changes…and I would like to be able to undo everything that a user has just done on the form.
Thanks.
View 1 Replies
View Related
Aug 15, 2005
Hi All,
Is there a way that I can make a button which will undo all the changes being made on a form (on multiple records). I have a continious form with a checkbox after each record and want to restore the 'old values' if necessary.
Thanks.
I know it's possible by record, but the tricky part is to do this on multiple records.
View 2 Replies
View Related
Feb 17, 2006
We have an mdb back end on our server with read / write permissions for several approved users. One of them (don't know who yet) has converted the mdb file from 1997 to 2000. Is there a way to undo this? :o (a few have both versions on their machines which is why this was possible to begin to with)
We have had this set up for almost four years now, with no issues might I add but always knew in the back of my mind something like this would happen.
Thanks
View 1 Replies
View Related
Jun 22, 2005
I have a form with a subform, on the mainform there is an undo button but when someone makes changes on the subform the undo button wont run and the error message "The command or action Undo isn't available now". How can i get the mainform to detect that changes have been made on the subform and then if the button is clicked undo the changes.
View 4 Replies
View Related
Mar 21, 2006
I would like to be able to check to see if undo is available.
ie. i have a button thats called 'Cancel' When clicked it undo's changed and then closes the form, but if there are aren't any changes to undo it flags up an error saying not available.
I would still like it to close the form even if there are no changes to undo.
So check to see if the undo is available then undo and close if not then just close the form.
View 4 Replies
View Related