is anyone has idea about how to undo update for subform?
i have a parent form(linked to A table) and a subform (linked to another table). the parent table has two button-save and cancel. i was wondering how the subform cancel update if the parent form's cancel button has been clicked? the code Me.undo will undo the parent form's record only, since the subform record has been saved into access.
I have a subform which asks a user to confirm the update before it happens - if the user selects no - then the update is cancelled.
When the parent (they are not related record wise) form is closed the update on the subform is attempted - if the user selects no - how can I cancel the close of the parent form. At the moment a message saying "Cannot save the record at this time - changes may be lost". Which I don't want to see.
I have a form and a subform in it. I added New cancel button in the form so that the the user can cancel the record creation and no record will be inserted in the parent table.
But when details are entered in the subform (a datasheet) row records will be created in the subform table. what is the correct method or how to cancel these records if the user choose to click cancel button on the parent form.
My membership database has worked fine until recently. Now I cannot save inserted data. On attempted saving "Update or CancelUpdate without AddNew or Edit" appears.
The problem. relates to 2 tables Member and Addresses. PK in the parent table Member is ID. In the Addresses Table the FK is ID. There is a One to One relation between the tables and Referential Integrity is set. I know 1 to 1 is not good but it worked fine in this small database.
I get an error "update or cancel update without add new or edit" which seems to point to this code.I am using MS Access 2010.
Code:
Private Sub Form_BeforeUpdate(Cancel As Integer) 'Store when record was last modified and by who. 'Initially stores when the record was entered. If Me.NewRecord = True Then Exit Sub 'Exit if new record Me.DateLastModified.Value = Now() Me.LastModifiedBy.Value = getUser() End Sub
I am having a problem with my cancl button on my form. this form has a subform. any changes cancel correctly on my main form. the problem is when there is a change on my subform and then is cancelled.. any ideas anyone? thanks!
I am trying to use a Combobox BeforeUpdate Event to achieve a required result.
I have two combo boxes inside a frame. The first is a year number 2011, 2012, 2013, 2014
The Second is the Week No ranging from 1-52, but 1-53 in some cases and this updates accordingly with the year number selected.
When the user has selected Week 53 and then changes the year to a year where only 52 weeks exist I want to Cancel their event.
I have already made a function to determine if 53 weeks exits however when I come to do the Cancel Event, the combobox for the year doesn't change back. It stays on the users new selection.
Below is the code that I am trying to use:
Private Sub cmbWeekNoFromYear_BeforeUpdate(Cancel As Integer) If UpdateWeekNoSelections Then Cancel = True Me.cmbWeekNoFromYear.Undo End If End Sub
'cmbWeekNoFromYear is the name of the combobox which holds the year number 'UpdateWeekNoSelections Simply returns True if I want the users change cancelled for cmbWeekNoFromYear
i have a main form with three sub forms on it. when i update subform 1 i want subform 2 and 3 to update..currently i have an after update event in a combo box subform 1
I moved this to it's own thread since it wasn't the same question as was posed by the thread creator. Pat
Not really the same issue but I thought to save us all from another thread...I have three subforms on a main form which are linked master/child. When I go through records on my first sub other two should be showing the additional info. I'm using requery as an form_current sub and works well with one sub, but doesn't work right with the other. The thing is that it shows the data on the form only if there is some data in the table already, but not if you want to add some new.
this is the code: ------------------ Private Sub Form_Current() Dim ParentDocName As String
On Error Resume Next ParentDocName = Me.Parent.Name
If Err <> 0 Then GoTo Form_Current_Exit Else On Error GoTo Form_Current_Err Me.Parent![tblInfoSub].Requery Me.Parent![tblInfo2Sub].Requery Me.Parent![tblKategorije subform].Requery End If -----------------------------------
since I am actually getting requery to work...what else might be the issue
I am building a debt management program in A2k. I have created a tabbed control which contains 6 pages based on a set of queries. These pages are a budget template and the intention is that when this form is inserted as a subform into the customers form the budget will open as a blank template with the budget categories displayed. The clients budget will then be entered and saved. The Budget table contains 56 budget categories.
At the moment when I insert the budget form and use it the only records that change are the template. I want the first 56 records to remain with zero values so that they display as blank for a new client but I want the total 56 new records to have the customer ID associated so that when that client record is accessed again their budget will appear. I have attached the SQL code for the query that displays a sub portion of the budget.
SELECT Budget.BudgetID, Budget.ClientID, Budget.SectionNumber, Budget.BudgetTitlesID, Budget.Description, Budget.Cash, Budget.Credit, Budget.Frequency, IIf([frequency]=1,([cash]*52/12),IIf([frequency]=2,([cash]*26/12),IIf([frequency]=3,([cash]),IIf([frequency]=4,([cash]/12),0)))) AS Totalscash, IIf([frequency]=1,([credit]*52/12),IIf([frequency]=2,([credit]*26/12),IIf([frequency]=3,([credit]),IIf([frequency]=4,([credit]/12),0)))) AS Totalcredit FROM Budget WHERE (((Budget.ClientID)=[forms]![customers].[clientid]) AND ((Budget.BudgetTitlesID)=1)) OR (((Budget.ClientID) Is Null) AND ((Budget.BudgetTitlesID)=1));
My thought was to do an after update event that would copy the clientID from the main form to the sub form and populate all the records in the budget. However, I have only succeeded in populating the individual record that has changed.
I probably haven't explained the problem sufficiently to get some help but would appreciate any thoughts.
Hello all! I'm using a form in data entry mode to add new orders into a table. When the Save button is pressed, an append query posts the order number and date to another table, and then enables a subform for data in that table. The subform is linked to the main form by the order and date to get only the record that was just entered/created.
While the subform does display the desired record, the user cannot update other fields in that table through the subform. I've searched all over the forums, and I'm probably missing something really simple. I've tried turning data entry on and off, changing different subform properties but to no avail. I can filter out the proper record on the subform, I just can't update it! Any help would be much appreciated. Thanks!
I have a form called NewRequisitions that had a combobox in which the users select the Supplier (name, address, shipping details). I created a button to open a subform called NewSupplier so that they can add a new supplier to the Supplier table as needed. My code works okay for the first "NewSupplier" entry - the table and combobox are both updated and the new supplier is available for selection in the dropdown list. However, when there is a 2nd record that needs a NewSupplier added the combobox list doesn't get refreshed. The record is added into the table okay but you can only view it if the NewRequisitions (main) form is closed and then reopened.
Here is the code in my subform:
Private Sub Form_Close()
If CurrentProject.AllForms(NewRequisitions).IsLoaded Then
'save the record if there have been any changes If Me.Dirty Then Me.Dirty = False
'requery combobox on other form Forms!NewRequisitions!ComboSupplier.ReQuery
'yield to other events - and put the new list into use DoEvents
I wonder if anyone could offer some advice on a problem with a form & subform?
I have a main form, based on table PublicationOrders: POrderID (pk) EventID(fk)
And a subform, EventDisplay, based on table Events: EventID (pk) EventName
The main form and subform are linked on the field EventID and my master and child links are correct, as far as I can tell.
The field EventID on the main form is a combobox, bound to field EventID in the table PublicationOrders. It allows the user to select which event an order is being sent to. In the Afterupdate property of this combobox, I have the code: Forms!PublicationOrders!EventDisplay.Requery
I would like the subform to update to show the details of the event that has just been selected from the combobox. However, for some reason, on afterupdate, the subform displays whichever event was selected when the previous record was entered. If I close and reopen the form, it will right itself and show the correct event information that corresponds with the order.
Any ideas why it's doing this? I have searched here for a solution but can't seem to find anything that relates.
Hi everyone. This probably sounds simple, but I cannot find the answer here, google, or my books (don't know if I'm searching the right words). I have a main form with five parmeter values, any of these acn be filled in, to filter the results in a query. I created a subform to display these results, however I cannot get the results to come up in the subform inside the main form. All I can get is the subform opening up in its own window, and even when this happens the subform inside the mainform stays the same. The only way I get the subform inside to update is by going into design mode and then back into formview mode. What have I missed or what am I doing wrong?
Hi got a good help with this and it's near a solution. I attached a form that has checkboxes to show and hide fields. This is a subform in a search form and bound to ID. So if a person is checked for "eget initiativ" it sticks to him/her. but the problem is that this should hide 2 textboxes, but if a person before has the bos checked for showing them, they doesn't hide when I filter the next person that has "eget initiativ check that's supposed to hide them.
If you uncheck it manually and check it again, they disapear. But that's not good enough. Any suggestions?
I have a private sub on a subform called txtsearchstring_change.
The txtsearchstring box is = to the client_id on the main form.
Basically when the user clicks on the next record button (which is on the main form) it should update the txtsearchstring_change on the subform and then display the new results in the list box.
Im not to sure how to do this. I understand im calling a sub from another form, so i did try a public not a private sub. And i have added on the next and previous button - txtsearchstring_change.
I have a form that has a related pop up from. I have an IF/Then/else statment. I want to up date a field in the orginal form from that if/then/else statement. I can get my IF/Then/Else statement to work on the subform but I can get it to update the orginal form. I might have a problem with my forms![xxxx]![yyyyy] syntax.
This is so simple but I can't seem to make it work. I've poured through about 30 posts and tried all kinds of AfterUpdate event strings to no avail. Help!
Here is the simple setup. I have one table that lists employees and their corresponding teamleader. A grouped query provides the record source for a combo box. The idea here is that you select a teamleader from the combo box and a subform updates to show all the corresponding employees. This subform is based on a simple query of all fields on the table.
After a scary recovery I have a new problem: Intially I changed the 'Data Entry' property on a subform, in a multi-tab form :eek: My tabs all dissappeared. (My Bad!:o ) Now that I have recovered I get a message when I close the form, asking do I want to save the changes to the design of the query. This only seems to happen when I have read a second or third etc record that displays a different set of records in the subform. This is a HR mdb with leave records in the subform. Any help would be appreciated. PS I thought I had posted this 2 hrs earlier, but can't seem to find it. Hoping this isn't a second posting ...:confused:
Hi, I am trying to update a subform by selecting a record in a combo-box that corresponds to a particular test when i select the said test i want an adjacent subform to change to the form displaying the test data in the subform window i have tried to use VBA to achieve this but so far have been unsucessful does anybody know how this can be done?
I'm trying to pass a value from my main form to my subform for the related records when the user clicks a button. The problem is that it either wants to update the entire table or can't "see" the value on the main form.
Here is my code
DoCmd.RunSQL "UPDATE [tbl_req_order] SET [process_status_rec_id] = [req_process_status_rec_id] WHERE req_rec_id = Me!req_rec_id;"
I'm a novice, so please bear with me. It works, but it always asks me what the value of Me!req_rec_id is. That's the primary key in the parent table that is linked to the subform. How can I tell it to use the value for the form the user is on?
I want to limit the values in a subform using a combo box. Basically I've got a Main Form that has name field etc. Selecting a different record shows me a different entry on the subform relating to a different name but now I want to use a combo box to limit what I see in the sub form another level. Any help would be wonderful.
I would like the subform in the lower left corner to be blank when I open the program. It is populated from my tblClients table. How it works in general is you select "x" number of items from the list box...hit the search button and the results go through a query and then show up in the subform. everything works ok but, like I stated I would like the subform to be blank when the program is first started up. It seems to be retaining information from the last start up in the subform box.
Thanks for your help...it's coming along great so far... see attached doc...