Subform problem: Inputbox reappears when closing DB

markmc

New member
Local time
Today, 15:37
Joined
Nov 13, 2014
Messages
2
Hello,

hope you can help me with something I've already spent half a day with without success.

I have a
- form called "Hauptformular" and a
- subform called "qry_tracking_Unterformular". Then there is a
- button called "cb_filialname".

Now when opening the Database, the form appears with the subform containing the
- query "qry_tracking"

When hitting the button "cb_filialname" the subform receives the contents of the
- query "qry_tracking_FilName", that has a filtering option on the Column "Filiale": "Like [Filialname?]"

Now the filtering works fine with the following Code:
PHP:
Private Sub cb_filialname_Click()
Me!qry_Tracking_Unterformular.Form.FilterOn = False
Me!qry_Tracking_Unterformular.Form.RecordSource = "qry_tracking_FilName"
End Sub
-> when you hit the button, the inputbox
Filialname?
appears.

The problem now is, that after having used the button, when I click the "Exit" cross right up there, the inputbox appears again. I've searched online a lot, but non of the solutions would word. So now I hope, you can help.
 
Hello,

When you close your form, it searches the parameter for its RecordSource.
I suggest you to put back the query "qry_tracking" as RecordSource of your form when you close it.

Good continuation
 
Hello,

When you close your form, it searches the parameter for its RecordSource.
I suggest you to put back the query "qry_tracking" as RecordSource of your form when you close it.

Good continuation

Thank you very much! Sounds very plausible. Do you have an idea, how to put the source back to "qry_tracking" for the event of form closure by closing the database? I know only the feature to execute something, when the form gets opened, but not when it gets closed.

Edit: Tried these two now:
On the sub form:
PHP:
Private Sub Form_Close()
qry_Tracking_Unterformular.Form.FilterOn = False
qry_Tracking_Unterformular.Form.RecordSource = "qry_tracking"
End Sub
On the main form:
PHP:
Private Sub Form_Close()
Me!qry_Tracking_Unterformular.Form.FilterOn = False
Me!qry_Tracking_Unterformular.Form.RecordSource = "qry_tracking"
End Sub
Private Sub qry_tracking_Unterformular_Exit(Cancel As Integer)
Me!qry_Tracking_Unterformular.Form.FilterOn = False
Me!qry_Tracking_Unterformular.Form.RecordSource = "qry_tracking"
End Sub
None of those worked...
 
Last edited:

Users who are viewing this thread

Back
Top Bottom