Solved Selecting data from combobox to be displayed on a subform (1 Viewer)

bilakos93

New member
Local time
Today, 09:44
Joined
Aug 25, 2023
Messages
27
Hello all
I have a tblEmployees (ID, EmpName), tblLeaveType (ID, LeaveName), tblEmpLeave (EmpID, LeaveID, StartDate, Dur)
I have a split form for entering data on the tblEmpLeave (combobox EmpID + EmpName, combobox LeaveID + LeaveName, StartDate, Dur)
I want to add a subform where all the leaves for a given employee will be displayed as soon as the user chooses one from thte first combobox.
I'm guessing I'll need to use the subform.requery somewhere?

Many thanks
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 14:44
Joined
May 7, 2009
Messages
19,243
the subform should have Link Master/Child Field on it's property (in design view).
the Master will be the combobox and the Child is [empID]
 

bilakos93

New member
Local time
Today, 09:44
Joined
Aug 25, 2023
Messages
27
thank you

that works well when navigating through records
i want the subform though to change each time a value from the combobox is selected when creating a new record
e.g.: when trying to create a new record. user selects employee3. subform shows employee3's leaves. then user selects employee2. same thing
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 14:44
Joined
May 7, 2009
Messages
19,243
i can't imagine your form so I cannot see what is going on with it.
 

bilakos93

New member
Local time
Today, 09:44
Joined
Aug 25, 2023
Messages
27
Here is my db

Thank you
 

Attachments

  • Database4.accdb
    2.5 MB · Views: 36
  • Database4.accdb
    2.5 MB · Views: 35

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 14:44
Joined
May 7, 2009
Messages
19,243
i added a hidden textbox (txtID).
the controlsource is:

=[StudName]

then i set the Master Link of the subform to txtID.
 

Attachments

  • Database4 (1).accdb
    2.5 MB · Views: 45

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 14:44
Joined
May 7, 2009
Messages
19,243
sorry, my db keep on restarting when selecting student on the combo.
i added code to the the current event of the form to set the value of txtID.
then added code to the Undo event of the Form and the StudName combo.
now it is ok.
 

Attachments

  • Database4 (1).accdb
    1.4 MB · Views: 48

Users who are viewing this thread

Top Bottom