Modules & VBA :: Undo Method When Using Form And Subform / Lookup Tables

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 Replies


ADVERTISEMENT

Forms :: Undo All Changes To Form And Subform?

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

How To Undo A Lookup Wizard

Feb 14, 2007

hey,

i have applied a lookup wizard to some fields, just to see what happened, and now i want to undo it... how do i do this pls?

thanks

View 3 Replies View Related

Undo Changes In Subform(in Datasheet View) From A Cick Event Of A Button In Main Form

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

Modules & VBA :: Preventing Undo Changes To Data In A Form

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

Modules & VBA :: Hide Undo Button Until Data Entry On Form?

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

Modules & VBA :: Set Focus Method - Filtering Records On A Form

May 27, 2014

I'm writing some simple code that will filter the records on a form:

Option Compare Database
Private Sub cmdOpenByAnalyst_Click()
cmbStaffNames.SetFocus
DoCmd.OpenForm "BICReviewForm", acNormal, , "Staff Assigned=" & "'" & cmbStaffNames.Text & "'"

End Sub

Unfortunately, I keep getting a run-time error (3075) that says "Syntax error (missing operator) in query expression 'Staff Assigned = XXXX"

View 3 Replies View Related

Undo On A Subform

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

Continuous Subform Undo

Mar 7, 2005

Hi

I have a form and a linked subform which are linked by Purchase Order Number. When items have been delivered on the purchase order, the user should update the continuous subform with the number of items that have been delivered. This works fine.

The problem I have is using an exit button that does not save any of the changes to either the data in the form or the subform. It doesn't matter if there is a prompt to alert the user that there have been changes made.

I have been messing around with DoCmd.RunCommand acCmdUndo in the on click event of my exit button which kind of works when changes has accidentally been made, but is very unsophisticated - any ideas?!

Thanks

Georgina

View 1 Replies View Related

Undo Edit On Subform

Nov 4, 2005

Hi,
Have a main form with subform. Can udo edits on the main form and am trying to do the same for the subform and am having problems. Can someone correct my syntax for me please..........and maybe someday I'll get it!

Here's my code below....thanx.

Private Sub PDEditUndoBut_Click()
On Error GoTo Err_PDEditUndoBut_Click

'Me.Label95.Visible = False
'Me.Label62.Visible = True
Beep
Me.Undo
Me.fmEmergency_Sub.Form.Undo


Exit_PDEditUndoBut_Click:
Exit Sub

Err_PDEditUndoBut_Click:
MsgBox Err.Number, Err.Description
Resume Exit_PDEditUndoBut_Click

End Sub

View 2 Replies View Related

Implement An Undo For A Subform

Jan 4, 2006

I have a main form (A) with a subform that is another form with a datasheet(A_SUB)

On the form A is an undo button which rewinds any changes that occur to A that I do not wish to commit. However when I make a change to A_SUB the changes are not rewound. I considered implementing an UNDO for A_SUB but this is messy. What would be a better solution?

View 2 Replies View Related

LookUp Tables For Dynamic Set Of Attributes: Set A Pointer Or Use A Generic LookUp?

Jul 24, 2007

I'm wrestling with the issues; in other threads, it became apparent that because I could not know ahead of time what I will need to know about a given entity, I will use a table to enumerate attributes that is applicable for a given entity.

However, the stumper is that what if an attribute should conform to a set list of values? Since they are dynamic, I would have problem predicting what I will need to be able to lookup, and am even don't know whether I will need a one-many lookup or many-many lookup.

I thought that generic lookup table with a table listing "classes" of lookup would allow me to have one big generic lookup table while using "classes" to act like virtual tables so I can then set the query to appropriate "class" to return just right set of values.

But as I thought about it, I ran into some issues which is pulling me toward the crazy idea that I should have freestanding tables, and use a field in tblAttribute to give me the table's name so I'd know which free-standing table it points to, and have the necessary key to lookup the values within that table.

Even though my gut instincts tell me that I shouldn't be going against the conventions of database design (who the frick goes around creating free-standing lookups?!?), I'm simply not sure how I can use a generic lookup table to hold all information.

For example, suppose I was given a list of values that has its own categories. Since the former design allows only for two level (lookup and lookupclass), where am I to insert that extra level?

Furthermore, I found myself needing a set of virtual keys to reference a certain "class" of lookups for report purposes. That means I need an extra field in my lookup table than I originally anticipates. What if I find myself needing one more field that just won't fit the generic lookup table?

So does anyone have suggestions on how we would create a placeholder for a lookup table that will be made just in time?

View 4 Replies View Related

Creating A Form Lookup From 2 Tables

Mar 20, 2008

Hey all.

I'm having a few issues with creating a Lookup on an Access form. I'll recreate the scenario below as best i can to help with my explanation.

I have 2 data entries. The first is a Post Code (Zip code), and the second is an Area Rating that applies to the Post code. For example:

Post code AB1 8 is awarded a rating of A
Post code SO1 3 is awarded a rating of F

I have already created a table in Excel with all 2,922 Post Codes (AB1 1 to ZE3 9) and the corresponding Area Rates (A to F)

What i'm making is a form that holds customer details. I'd like a combo box or text box that when you type in the Post Code, another text box automatically displays it's corresponding Area Rating.

Code:Post Code: Area Rating:------------- --------------| CM2 7 | | A |------------- --------------

I apologise for my really very poor diagram :P

So the Post Code box is either typed into or a combo box with the list of Post Codes, and the Area Rate box cannot be typed in to, but it automatically displays the record dependant on what is in the Post Code box.

Ideally, these will also be recorded onto the main table (IE not the table with the list of post codes or area ratings, but a 3rd table holding the rest of the details that will be used to create statistics and graphs)

Can anyone help me with how to do this? I've been trying to work it out all afternoon!

Any help is really appreciated.

View 3 Replies View Related

Modules & VBA :: Beforeupdate Event Undo Change To A Combo Box?

Oct 7, 2013

I'm working on a bit of code that before a combobox is changed checks with the user to confirm that they want the change to go ahead, if yes a recorded is added to a table

This all work fine apart from if no is selected - I am trying to get the combobox to undo the change however when you select no the msgbox pops up fine but the combobox does not undo

Can't see where I'm going wrong I thought undo worked for comboboxes

Code:
' Displays a message box with the yes and no options.
Response = MsgBox(prompt:="Do you wish to change the status of this Job? 'Yes' or 'No'.", Buttons:=vbYesNo)
' If Yes button selected
If Response = vbYes Then

[Code] .....

View 3 Replies View Related

Modules & VBA :: Lookup Column In Text Box Access Form

Apr 5, 2015

I have 1 combo box and 1 text box i look up 2 columns in the combo box from that combo box i want to look up 2 column to text box

example:
Table values:
Col 1 Col 2
A 1
A 2

combo box successfully look up 2 columns but i look up to text box

Formula: =combo1.column(1)

But the text box look up the first row always even i choose the second row A

Also look-up first row 1

Any solution to look up 2nd row?

View 3 Replies View Related

Modules & VBA :: Run Python Method With Arguments?

Aug 18, 2014

I have a python script "runAll" that takes two arguments: processID (the primary key of one table as a string) and a filename (a full file name path as a string).

Is it possible to run a python method with arguments from inside a VBA script (activated by a button press)?

My python script is called XMLGenerator.py, and the method I want to run is called runAll(processID,filename).

View 4 Replies View Related

Modules & VBA :: Outlook Restrict Method From Access

Mar 13, 2015

I have the below script:

For Each Item In offexchfldr.Items.Restrict("[SenderName] = '" & frmfm & "'") ' Select Items that match Sender Name on form
If Item.TaskSubject = subid Then
Item.Categories = frmcat ' Update category from form to outlook
Item.Save
End If
Next

This script checks every item in the outlook inbox where the item.SenderName = my database sendername

This works every time except for when the sendername has quotes or single quotes in their name. So i am trying to utlize the replace method on the item sendername before trying to find the items in the inbox but its not working.

Below is my attempt that does not work.

For Each Item In offexchfldr.Items.Restrict("Replace([SenderName],',"") = '" & frmfm & "'") ' Select Items that match Sender Name on form

View 2 Replies View Related

Modules & VBA :: Set Of Fields - Method For Locking Records?

Aug 20, 2013

On my form I have a set of fields that can be displayed as editable or read-only depending on a "Lockout" checkbox for that record.Is there an easier way of doing this? If not, would it be smarter to create a function to do this? As it stands I'm assuming I would have to have this code run when the form loads, when the Lockout box is clicked, and whenever the record is changed just to ensure that the records are displayed as locked or unlocked appropriately.

Here's what I have:

Code:
Private Sub Lockout_Click()
If [Lockout] = True Then
Me![Customer_Text].Enabled = False
Me![ReqDesc_Text].Enabled = False
Me![MoreInfo_Text].Enabled = False

[code]....

View 4 Replies View Related

Modules & VBA :: Method Or Data Member Not Found

Jan 19, 2015

i have the following code in a function but when i want to compile it i have the following code will be blue i have error in this line:

.NamedParameters = True

the error message is this :

method or data member not found

my code is as following:

Function Get_Bearbeiter_Detail(ByVal vBearbeiter_Code As String, Optional ByRef vBearbeiter_Name As String, Optional ByRef vReadOnly_Flag As Boolean, Optional ByRef vAnalyser_Flag As Boolean, Optional ByRef vAdmin_Flag As Boolean) As Boolean
On Error GoTo Err
DoCmd.Hourglass True
Dim rst As ADODB.Recordset

[code].....

View 1 Replies View Related

Undo Won't Undo Last Function.

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

Undo, Won't Undo - Do I Understand Right?

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

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 1 Replies View Related

Forms :: Undo Only One Field On A Form?

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

Modules & VBA :: Finding Last Record (QueryDef Or Recordset Method)

Feb 11, 2014

My question is which method of finding the last record is best, QueryDef or Recordset? Here is my data:

Table:
tbl_module_repairs

Field:
aps_rma

Textbox to insert last record RMA into:
txt_test

Here is some code I tried but get an invalid argument msgbox:

'''''''''''''''''''''''''''''''''
'Opens last RMA into textbox (For opening tag sheet)
Dim dbs As DAO.Database
Dim rst As DAO.Recordset
'Get the database and Recordset
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("tbl_module_repairs")

[Code] .....

View 14 Replies View Related

Modules & VBA :: Method Import Xml Of Object Application Failed

Dec 10, 2013

I am attempting to pull data from an XML file via VBA without doing the import on external data. I created a blank table called "tblHolding". In theory, my code works the way i want which is: User clicks button, file explorer opens for them to select the file, imports data to "tblHolding", and msg box saying complete.

It runs through the code but doesn't import. It errors at the below code. Also, where do i reference the table so I can append the data.Fails saying method importxml of object application failed

Code:
Application.ImportXML strPath & strFileList(intFile), 2

Code:
Private Sub Command234_Click()
Dim strFile As String 'Filename
Dim strFileList() As String 'File Array
Dim intFile As Integer 'File Number
Dim strPath As String ' Path to file folder
Dim f As Object

[code]...

View 5 Replies View Related

Tables :: Lookup Field Using Another Multi Value Lookup Field As Data Source

Nov 23, 2012

how to do a particular thing in Access 2010 (I don't even know if it is possible).

I have a table named PRODUCTS:
ID_PRODUCT (primary key, autonumber long integer)
ALLOWED_OPTIONS (multi value text lookup field: "Option 1";"Option 2";...;"Option 9")

So I can store, for each different product, none, one, or more options to let the customers choose from.

I have a table named ORDERS:
ID_ORDER (primary key, autonumber long integer)
FK_CUSTOMER (foreign key, linked to the primary key of a CUSTOMERS table; represents the customer that places the order.)
FK_PRODUCT (foreign key, linked to PRODUCTS.ID_PRODUCT; represents the product that the customer has choosen)
CHOOSEN_OPTION (lookup text field; the customer must choose ONE option among those allowed for the product he has ordered)

The problem is that I would like the CHOOSEN_OPTION field to show as a combobox, listing the values stored into PRODUCTS.ALLOWED_OPTIONS, so that when a customer buys a product, he can choose only among the options allowed by that particular product.How can I manage a multi value field to populate a combobox, in which every item stays on its line? If I use, as a query to populate the combobox:

select [PRODUCTS].[ALLOWED_OPTIONS]
from PRODUCTS
where [PRODUCTS].[ID_PRODUCT]=[FK_PRODUCT]

I obtain an empty combobox.If I refer to the last field as [ORDERS].[FK_PRODUCT], Access asks me to type a value for "[ORDERS].[FK_PRODUCT]", treating it as an unknown parameter.I think that the problem is that when the combobox expands, the record is not committed yet, so FK_PRODUCT is unknown (NULL?). But this happens even if I commit the record typing something in FK_PRODUCT and then I re-enter the record and I expand the CHOOSEN_OPTION combobox, that is still empy although FK_PRODUCT exists, now.Is there a particular syntax to refer to a field in a record not committed yet (something like "THIS." or "ME.")?

View 5 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved