I'm trying to requry a sub form based either or both text boxes. I need help with the code. I'm trying to rewrite something from a sample but can't seem to get it to use the criteria. It does requery though.
Private Sub cmdSearch_Click()
Dim sCriteria As String
sCriteria = "WHERE 1=1 "
If Me![Search] <> "" Then
sCriteria = sCriteria & " AND MedicalRecordsUpdating.SerialNumber """ & Search & """"
End If
If Me![SearchEvent] <> "" Then
sCriteria = sCriteria & " AND MedicalRecordsUpdating.Event """ & SearchEvent & """"
End If
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 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 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 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).
I have a form that contains a subform, upon clicking the notes button a new form is presented. Upon saving data I want the form to requery the publishers sub form here is my attached code:
Private Sub buttonsave_Click() DoCmd.Save Forms!Publisher![Notes subform].SetFocus Forms!Publisher![Notes subform].Requery DoCmd.Close End Sub
The for does not requery I have to move to the next record and come back to see the new updated notes. TIA
I'm having trouble updating a combo box automatically. I have a main form [Orders] containing a combo box with a list of Buyers. Inside this main form is also a subform, [Order Details], containing products to be ordered which is also selected by a combo box. However, each buyer has a different set of products. I tried filtering for only the products by a certain buyer but when I go to a new record, the product list remains the same according to the buyer on the first record when the form was opened. What do I need to do inorder to have only the products for the chosen buyer appear in the combo box when a buyer is selected in the main form?
I am a newbie to access and am having some difficulty with a subform. I have searched the forum, but could not find an exact match to my problem.
The following is a simplified version of my problem:
Tables: TSerialNumber, TLocation, TSubLocation(Location and SubLocation Fields)
Form: ServiceForm SubForm: ServiceSubForm Form and SubForm linked by SerialNumber
In the SubForm: I have 2 ComboBoxes: Location, SubLocation Location - Row Source is the Table TLocation SubLocation - Row Source is a Query of SubLocation relating to the Location
I need the SubLocation field to be requeried OnChange from the Location ComboBox.
If I use the subform as a form I can get this to work by using a macro to requery the SubLocation, but when I try to use it as a subform I get an ApplyFilter Error.
I hope someone can help... and i hope i can explain this properly. Some background... I have a form which has a Global ID as one of the fields. From this form another audit results form can be opened (on the click of a button) that shows the results of Audits based on this ID. The results of audits are in a flat un-normalised table(this is not an issue at this point)
On the top of the audit results is a textbox for the 'GID', the contents of which have been copied from the original form where the button was located. This process uses a macro.
OpenForm Set Value [Forms]![frm_Audit Result]![Audit Result GID] =[Forms]![frm_Call Log]![txt_Global ID]
The audit results form has a subform which displays the result of a query based on the the value that is copied.
The txtbox displays the value fine, but the subform does not display the result of the query.
The query has number of fields but the criteria for filtering the correct ID's is: [Forms]![frm_Audit Result]![Audit Result GID]
Its just that the subfrom does not display any result as soon as the audit results form is launched. If I alter the number in the text box and hit enter, the subform displays the correct results.
The subforms Record source is the query.
I've tried numerous ways around the problem with various attempt to update the query on various events, but have had no luck.
I guess i need to rerun the query and then refresh the subform once the main form has the GID copied over... but am not sure how to rerun the query and at what point/with which event?
Hi. First off I want to say that these forums are a gold mine. You all do a great job. Keep it up!
I work at a University and keep a database of students. On the main form for the student, you select their name from a combo box and the whole form refreshes to show the data for your selection. There are four subforms that keep track of things like a questionnaire, career center visits, etc. The problem I am having is with the Career Center visits.
There is a button that allows you to make an entry into a log when they come into the career center. Clicking on it opens up a small window where you can put notes and with whom they spoke while they were here. Upon closing the window, it adds the entry to the log for that particular student. That all works great. Each student has their own log...all is good.
However, upon closing the window, the main form jumps back to the first student in the list. The entry is added to the correct student, but you must find the student from the combo box in order to see it. It is just annoying to have to do it and I would like to fix it. Can't figure out why it is doing it, though.
Any ideas? I would like it to add the entry to the student, and stay on their record.
First post, but based on a long look-around, I'd say that if I can't find a solution here - there probably isn't one! :D And it's probably a simple one as well ...
My problem is the following: I have setup a SubForm with two dropdowns - the second requerying based on what's selected in the first. It works like a charm when I open the subform by itself, the values update and everything. However, when I place this subform into another form it all of a sudden fails to register, and instead the "Enter parameter values" message comes up, with the seemingly correct Forms!SubForm!Value note. When I type in the value that I've just selected from the dropdown, the second dropdown updates correctly.
I know I must be overlooking something, but I feel I have checked everything I can - especially seeing as it works fine when run by itself.
I have used the following command on a command button to requery my subform and it works as I planned. However, if I copy it to say,the OpenEvent for the same form, nothing happens. I'm obviously missing something here. [Forms]![Customers]![mysubform].Form.Requery
I have a subform that contains two combo boxes, 'cboPrimary_Source' and 'cboSecondary_Source'. When you select the primary source e.g. 'Direct Mail' a number of related options appear for selection in the secondary source combo box e.g. Letter, Email, Fax. When you open the subform only, this works just fine using the requery.
However, when you open the main form 'Prospects' where the subform sits it does not work. The primary source combo can be selected, but when you select the secondary source combo an error message appears 'Enter parameter value: Forms!Subdatasheet_Subform!cboPrimary_Source'.
The code used on the Subdatasheet_Subform is as follows:
Option Compare Database
Private Sub cboPrimary_Source_AfterUpdate() Me!CBOSecondary_Source.Requery Me!CBOSecondary_Source.SetFocus End Sub
Private Sub Form_AfterUpdate() Me!CBOSecondary_Source.Requery End Sub
Private Sub Form_Current() Me!CBOSecondary_Source.Requery End Sub
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.
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
Apologies in advance for the basic nature of this, but in the past two years I have forgotten everything i ever knew!
I have two tables - Holders (holderID, name, current address) and Addresses (addressID, address1, city, etc)
current address is linked to addressID
I am trying to create a form (frmHolders) that shows the details from holders and pulls in the address using a subform (sfrmHolders)
On the main form I have used a combo box for current address so that it can be changed. What I want is for the address on the subform to refresh when the current address is changed in the combo.
I am using this:
Private Sub cboAddress_Change() Me!sfrmHolders.Requery End Sub
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;
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
There are 2 levels of forms, the main parent form is called INSPECTION. Then there are two subforms: TESTRESULTS and addTESTRESULTS.
the form TESTRESULTS is linked to the TESTRESULTS query "QTESTRESULTS2". This query looks at two hidden fields on INSPECTION called FILE and REPORT NO. The query finds all fields inside of TESTRESULTS that match the two criteria. This works fine. The form TESTRESULTS is linked to the QTESTRESULTS2 query as direct data source link. This works fine.
a temporary table has been setup to append test results to TESTRESULT table. This works fine. What doesn't work fine is updating the subform TESTRESULTS when needed. I want it so that the welder enters his information, clicks save, the info gets appended to TESTRESULTS table and instantly updates on the form for them to verify.
[inside subroutine for saving a record] all efforts at accessing this form have failed. I've tried !form!subform!requery, it has failed, I've tried making dummy fields inside the form and accessing them and that has failed, I've tried .setfocus on the form and that has failed, each time the compiler tells me 'unknown field', when in fact I'm trying to hit the form itself.
Its worth mentioning that I've set events [on this form for any kind of update event including mouse click] to Me.requery for this form when you click on it, it updates, but I need to automate this somehow, and the form just seems untouchable via VBA.
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.