Populate subform based on combobox values in the main form
I have a Details subform, which I have to populate based on the values in combo boxes. The subform is bound.
Thank you for taking the time to report an issue.
What's wrong... Please write below.
I need to populate a combobox filter on a subform based on what is selected on a filter combobox on my mainform but no matter what I try I can't seem to get this to work.
I can populate the combobox filter on the subform using a normal combobox on that same form but can't populate the combobox filter on the subform using the filter on the main form.
I am aware that there is different syntax used to access a control on a subform and am 100% sure my syntax is perfect.
I have read numerous topics on this site relating to this topic and I have tried all the responses but I just keeping getting lost in the middle of the
Client_info is table name
id is field name
cboid is combobox name in mainform
client_info_sub is subform name
Private Sub cboid_AfterUpdate()
Dim LSQL As String
LSQL = "select * from Client_Info"
LSQL = LSQL & " where ID = '" & cboId & "'"
Form_Client_Info_sub.RecordSource = LSQL
The first subform contains all records from a table and loads perfectly fine when the main form is opened
The second displays a subset of the same records based - a list of records for a selected company ID, this in contrast to the first subform appears blank when the main form opens.
I can manually populate the blank subform by pressing F5, adding a refresh button (uses me.reacalc) and by making the comany ID field a combox and using an after update event that refreshes the form.
I would like the empty subform to populate using the company ID selected when the form is opened (this comes from another form).
I have tried re-calculating the form using several events such as AfterUpdate - but can not get this subform to populate
As of now, I have tried to implement this and as I select any value from the first combobox of row 1 I see the second combobox of the same row gets populated but as I go on selecting values from the first set of comboboxes I see that the values in the second set of the comboboxes above changing or becoming null.
The 1st combobox is cboRCMTask:
INSERT INTO tblSubTeamEvent ( SubTeamID, EventID )
VALUES (Me!SubFormSubTeamForm.Form!cmboSubTeamSF, [Forms]![frmEvent]![EventID]);
but when I run it it asks for the parameter value of the cmboSubTeamSF. If I just ignore the question it still updates the EventID into the table but obviously not the SubTeamID. I've tried various combinations of Me! Forms! etc but can't get it to work any ideas any one
The combo box operates properly. I see all my data in the combo box. My issue is when I select data in my combobox, lets say the number 99, nothing happens in my subform.
If I change records of my main form and come back to the previous record, the "99" is showing in the subform along with the other data I want.
I want the subform to change as soon as I select my data in my combobox. I wrote some code so when the combobox updates, it requerys the subform. But what happens, the subform requerys, and just the field that my combobox writes to updates, the other fields are blank.
Then, if I change main records and come back, the data is there. What am I missing?
I have added a combo box to the subform and I'd like to have it populate the fields in the subform, but still have the entire subform linked to the main form.
I have attached a screenshot to help.
What I need to for the records to be filtered by the Section Field using either of the three options in the ComboBox. The ComboBox looksup data from a Sections table (SectionID, Section).
Main Table Name: Orders (Master Link: Order ID)
SubForm Table Name: Order Details (Child Link: Order ID)
ComboBox Object Name: CboFilter