Rerunning subform

gary.newport

Registered User.
Local time
Today, 08:04
Joined
Oct 14, 2009
Messages
79
I have a form that is based upon a crosstab query. Due to the fact that the column widths vary I cannot have the form based upon this query if I want to have it as a subform. I need it as a subform since the data being displayed is based upon four dropdowns on the main form (Course, Unit, Class, Student).

When the form loads the fours dropdowns are empty and so the subform loads, reads in the form_load. The form_load executes another subroutine that sets the recordset of the form accordingly and makes controls visible or invisible as required. When everything is null then a single label appears stating that "This unit of work has no data".

All of this is working. If I hardwire a unit, class or student value then everything works fine (the Course value is to be used for something else).

However, if I load the form (everything works as expected0 and then change the Unit dropdown in the main form, how can I get the subform to execute all the code again AND display the data in the subform as expected?
 
I have solved this!

Code:
Me.Unit_Results.SourceObject = ""
Me.Unit_Results.SourceObject = "frm_unit_results"

Since this also allows me to move to the Course problem with a new subform I like this solution. If anyone can identify why this is a terrible idea please post!
 

Users who are viewing this thread

Back
Top Bottom