Forms :: Update / Requery Subform Through On Close Event Of Another Form
Aug 2, 2013
I am working with 2 forms and a subform.
frmTaskTracker -subfrmInbox (Datasheet View - based on a query)
frmUpdateInboxItem
subfrmInbox displays a summary of tasks on a task list. The user navigates to frmUpdateInboxItem from frmTaskTracker. After updating a record from frmUpdateInboxItem, it is possible that it the record in question will no longer meet the requirements to have it listed on subfrmInbox.
I have attempted to add code to the on close event of frmUpdateInboxItem to requery the sub form on frmTaskTracker but am not getting the syntax correct.
correct my code? Alternatively is there is a more correct way to do this, I'd be happy to learn it.
Code:
Option Compare Database
Private Sub cmdClose_Click()
Me.[frmTasktracker]![subfrmInbox].Requery
DoCmd.Close acForm, "frmUpdateInboxItem"
End Sub
I have a Main form with a combo box that pulls names from a table. Alongside the combo box is a command button that opens a form which allows the user to edit the names in the table.
The problem: When a user edits a name and closes the edit form, the edit is not immediately displayed in the combo box. However, when the Main form is closed and reopened, the edit is properly displayed. Can I somehow refresh the combo box in the On Close event of the edit form?
I need to requery a subform from a third form and can't seem to get it to work.
frmForm1 has frmAddress as a subform. The button cmdReviseAddress opens the form frmUpdateAddress where all of my validation work is done and the new record is added.
However, the new address is not being displayed in the subform.
If I use the command Forms![frmTest]![frmAddress].Requery it works fine.
The problem is that I want to be able to frmAddress on any form, and need to pass the name of the main form (in this case frmForm1) as a variable.
If lsTemp = "frmForm1", the statement Forms![lsTemp]![frmAddress].Requery (and every variation using brackets and quotes that I can think of) fails.
I have a split form that's like a list of pending tasks. The data source is a linked SharePoint 2013 list where users submit requests. The user takes the information from each record and performs an action. When it is done, the user presses a button and the task status changes from "Pending" to "Processed". The form record source is based on a query that finds only records with a status of "Pending" so when the user changes the status of the task, it is removed from the list. It works fine except when there is only one task left in the work list. If the user processes the last task, the form refreshes and it goes to a new empty record and I get an error message that says I must enter a value into one of the required fields. I tried making the field non-required but it just creates an empty record in the table.
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 have a form called Add New Delegation, i have combo box of Institution names on the main form and a subform for Agreements discussed. with a combo box called agreements. I successfully cascaded the combo boxes so that the agreements discussed on the subform are filtered by their respective institutions on the main form. However i am unable to refresh the list each time a new institution is selected as the Macro will not allow me to requery a control on the mainform from the subform..
I have a form (frmAddManifest) with a subform (subfrmManifestTransporters).
When creating a new record, I can enter data into frmAddManifest, but the subform doesn't update to link with the record - I presume it's because the record from the main form hasn't been completed yet.
Is there a way to requery the form and/or subform so it stays on the record I was working on, and link the subform properly?
Is there a way to cancel a form's close event? If a user clicks the form's close button, I want a msgbox to ask if they are sure, and if yes continue and close, else cancel the forms close event. I know how to perform the msgbox and the if statement. I can not figure out how to cancel the form's close event.
I have a subform which makes a change to a field on the main form. When focus is returned to the main form, the BeforeUpdate and AfterUpdate events fire. Why? I thought from the form's perspective, the subform is just another control.
BTW, I get the same behavior if I modify the field from within the Exit event of the subform control.
In either case, the main form's Dirty event is NOT triggered.
This code works well and frmRepair opens with the updated label caption. The original value was "Return/repair Information"
A few other things need to change on frmRepair depending on this caption as well as the values of some other fields, so I use the following code in the onload event (although I later tried the onopen even)
Code: 'Disable labels button if there is no RMA and the item is a repair MsgBox Me.lblmain.Caption If Me.lblmain.Caption = "Return/Repair Information" Then Me.txtRMA.SetFocus MsgBox Me.txtRMA.Text
[Code] ....
However, I cannot get this to work as the "if" statement always returns "Return/Repair information" and not the modified caption. The message box confirms that this is the case.
I suspect that this has to do with the point in time that the frmRepair loads or opens and when my code enters the modified values.
I have a simple data entry form on which there are about 30 to 40 data fields to be update by users. One of the field is called "Stage" which is a combo box with 2 entries "Formal Case" and "Informal Case" with no default value whien a form is first opened.
Users will normally create a data entry which updates the table and save.
However if in future users open any one existing record and try to change Stage field from Informal to Formal or vice a versa I would then like this action to
1) update a time stamp concatinated with the stage change value in a text field perhaps
2) save/close the form
3) open a new form with all the existing entries(plus changed status of "Stage Field") with a new record ID and new time stamp.
I have two sub forms on a main form.Subform 1 displays information which comes from a query, filtered using two combo boxes on the same form.The active record on the data sheet has two field values output to hidden text boxes on the form.
These text boxes then provide the values used for the query displayed on the 2nd sub form.When I highlight a new record in subform 1, the text box values change, but the values in sub form 2 do no.Which would be the best method to use to get this to requery?
All I am trying to do is get a subform to requery after choosing a name from a combobox on the subform itself, thus updating the records on the subform. The main form name is "BasicTestOneF" the subform name is "ICminiBasicF" and the combobox name is "Combo4"
I have the combobox requery on After Update, but I still get the "Enter Parameter Value" popup. I've spent the last hour and a half just trying to get this simple thing to work and have gone through I don't know how many sites and forum posts, tried every combination of VBA code I've found, and I still can't get it to work.
I have a query in a subform on the main form. I have a search box that updates the subform/query as you type something (using the On Change event). You then click on the record you want which transfers the information to the appropriate text boxes (one of these txt boxes is the clientID I talk about below) located next to the search box.
I have a Contacts subform/query much like the serarch box I created and I am using a txt box (on the main frm) clientID (which I get from the above process) to filter the contacts.Now when I pass the ID to the txt box on the main form I am having trouble getting a event to trigger and update the subform/query correctly.
I am using VBA to create a simulated Click action which seems to work but is not updating the Contact subform/query, it is just resetting the subform/query. If I manually click on the txtbox with a ID in there all works wonderfully. I have attached the database. I made the clientID and btn next to it visible(this would not be visible normally).I just realised I left a button on the main form next to the clientID txt box just ignore that and click on a client then the clientID txt box to see how it updates the contacts subform..
I have a main form that has two subforms, subform1 and subform2, both connected to the main form. When I enter data into a field in subform1 I want subform2 to requery and update to show the calculated results from the new or changed data in subform1.
I found that if I do a refresh it works when changing the data but not when entering a new line of data in subform1. I tried some code in the after update field of on subform1, but cannot seem to get anything to work.
Me.[subform2].Form.Requery
Does not work. It errors and says it cannot recognize subform2 as a field. I have tried a field name on subform2 but I still got the same error.
I have created a split form that shows all records from the main table. On the split form (form1) I have a button that opens a second form (form2) to add records. On form2 I created a button to save the records and that works fine, but form1 does not show the new record after the save button is clicked.
I am attempting to use requery to show the new record but I am not having any luck. Right now, form1 only shows the update if I switch to detail view and then back to form view. Maybe I am not doing something right, I am new to using MS Access and VBA. I have tried using the requery with an onclick on the save button and I also tried using requery on form1 in the ongotfocus event. I am using a macro to do the requery, and I have left the argument blank.
Can someone please point me in the right direction to fix this?
I have a main form that identifies a Client File: frmClientFile (Single Form)
On the main form is a subform for Cases: subfrmCases (Continuous form)
Also on the main form below the Cases subform is a tab control that contains additional subforms to view/update different aspects of a case: subfrmCaseClients (Continuous Form).
The way this operates is that the user first chooses a file using a combobox on frmClientFile.
The subfrmCases is linked to the main form (using the caseFileID) and filters correctly.
The subfrmCaseClients is then linked using some hidden text fields on the main form (using caseFileID, CaseID) and this filters correctly.
On subfrmCaseClients is a combobox (cboClientID) that I need to requery based upon the Case Row selected on subfrmCases.
I have tried numerous combinations of options to force the requery by trying to apply a macro on the following:
OnCurrent, OnSelectionChange, OnChange and AfterUpdate events to no avail.
If I hit F5 to refresh the entire page the combo box gets updated as expected.
How do I get the Requery to work programatically? Is this even possible?
I have a main form (Frm ViewModel) with a subform (Frm class_attributes) in datasheet-mode based on a Query.Frm ViewModel has two controls, a ComboBox Select Model (presents you with a list of data models ) and a ComboBox Select Class (presents you with a list of Classes selected from a class-table, based on the model-id derived from the Select Model ComboBox). The subform Frm class_attrbutes shows you all class attribute combinations based on the model-id derived from the Select Model ComboBox.After the initial selection of the classes and attributes, the subform Frm class_attribute can be filtered on class by the Select Class ComboBox.
As long as I just switch between models through the Select Model ComboBox, it all works fine. The subform Frm class_attributes is updated (Requery) correctly.The problems start when I filter the subform Frm class_attributes, either through VBA OR by using the GUI filter possibilities of the sub form itself.
The filter works fine, but once youve used it: - The filter stays active, even when turned off, so when you Requery the subform it reutrns results with the original filter. - The filter is removed, but now the subform after requery keeps showing the selection of classes & attributes for the model_id where the filter was first set.
I tried all possible combinations of FilterOn = False and .Requery but it doesnt solve it. I tried reassigning the RecordSource but since the underlying SQL is extensive (a few joins) Access seems to have a problem with this
I tried making the sub-form a bound form by manually linking the masterfield to the Select Class ComboBox..I played around with the On-Focus and OnCurrent-events
I'm trying to execute some lines of code right after deleting a record in a subform, with a right click on the row I want to delete (the idea is that if a record is deleted the other ones should be updated by module1.tblUpdateLatestDocuments).
I've tried putting this code into the events On Delete and After Del Confirm of the subform, none of that worked.
Code: Option Compare Database Private Sub Form_AfterDelConfirm(Status As Integer) Call Module1.tblUpdateLatestDocuments Me.Requery End Sub
Private Sub Form_Delete(Cancel As Integer) Call Module1.tblUpdateLatestDocuments Me.Requery End Sub
Aren't there any events that I could use right AFTER the record has been deleted?
On there is a Subform called subfrmFront and that has a source object of the form f_front
A button on f_main opens up a popup. In this popup, the fields I am updating all relate to the same records that are being displayed in the subform. Everything updates OK in the popup (i.e I can see in the table that the updated information is in there), but the subform back on f_main still has the old data in it.
I need to requery that subform to show the new data I just inputted.
If I close f_main and re-open it, the latest data is in there, but surely there is a way to make sure it updates on the close of the popup form.
I have a main form with a couple of tabs, forms and subforms (see attachment). The problem is that when I click on one of the blue record navigators, I want the right subform to requery. I can't get that to function properly.
Until now I'm just using the Macro Builder and little to no VBA. There is a function Requery in the MB, but I keep getting error messages that the object doesn't exist or nothing happens at all.
I've read the page on Access mvps about linking to forms, but I'm still doing something wrong.
When I used some VB like: Me.Parent!frmStagesPerLeerling2.Form.Requery
it did work, but I an into problems with setting the visibility of the navigation buttons (they should only show when there is more then one record in that subform).
Hi. Having a bit of a problem getting a subform to requery/refresh after running a query from a seperate form. The seperate form is acting as a 'search form' and running query qSearch.
I've tried various things (requery the form, subform etc) but here is the code I'm currently using:
Private Sub RunqSearch_Click() DoCmd.OpenForm "Papers" Forms.Papers.RecordSource = "qSearch" Forms.Papers!Authors.Form.RecordSource = "qSearch" Forms.Papers!Authors.Form!AuthorName.ControlSource = "qSearch.AuthorName" Forms.Papers!Authors.Form.Requery Forms.Papers.Requery DoCmd.Close acForm, Me.Name End Sub
The main form is requerying fine, but the subform isn't. Any help would be appreciated. Thanks
I have a subform in a tab within a mainform. Within the tab there is a button to open a form to delete/add data to the subform. So upon closing this pop up form I want to update the subform to show what has been deleted or added, I have tried the various things to requery the subform but none of it seems to work, here is what I have tried;