SetGetSB.Zip Implementation

J

John Keith

I was searching for the solution to keeping the selected record of a
continous form in the same place after a requery. I was pointed to Stephen
Lebans solution at http://www.lebans.com/setgetsb.htm

The initial set up worked great. However I have a complex app and i'm
having trouble getting the "other" parts to work now.

Application description:
Main-Form has a sub-form, sub-form has a cmdbutton that launches a
modal-popup search form to select a key that is set into the sub-form filter.
The main-form detail shows a list of all possible student-applications to
select. Students are grouped by a tracer-key which represents a household.
The sub-form shows a group of house-hold members for a tracer-key.
A button on the sub-form allows choosing a tracer-key by poping up a form
with searches to filter the data then select a household-tracer by clicking.
This returns back to the main & sub form and filters the sub-form records to
that house-hold-tracer.

I imported the class module: clsSetRow and the standard module:
modGet-SetScrollInfo. Then added the calling code to my main-form's module.

The main-form's detail click will add the clicked-on student-application to
the household by setting the tracer on that detail record. The form and
sub-form are requeried and the main-form detail is set back to the current
record just fine.

I have added the same calling-code that the main-form has to the sub-form
module. I replaced me.___ in all cases with me.parent.___ thinking that this
would keep the main-form's detail scrolled to the same record that it was on
originally after the fields were updated and the form requeried.

The issue is that the pop-up form when attempting to set the sub-form filter
is calling the sub-form's_Current module, that should work, but after it
completes the code and comes back to finish the popup modules routine the
DoCmd.Close does not close the pop-up and the routine just exits leaving the
popup having focus and the main/sub form is nowhere to be found.

I tried adding a DoEvents after the DoCmd.Close, but I get the same results.

Any thoughts on what I am doing wrong?
 
J

John Keith

More testing...

After commenting out all the new code in the sub-form, the issue was still
happening. I then commented the Form_Current() and Form_Load() routines
completely... THEN things started working again.

I re-created a husk in the sub-form module:
Private Sub Form_Current()
End Sub

And that broke the process again.

It seems that the instance of Me. that goes with the original calling form,
after the popup form jumps into the sub-form's module it is creating a new
instance of the sub-form with out the orignal settings.

ctlKeyIn is a global variable dim'd in a standard module that is populated
via
Set ctlKeyIn = Me.Controls("SelectedTiesToTracer")
In the Sub-form's module's btn_click routine before loading the pop-up form.

The pop-up form's module after a row is clicked, populates the calling
sub-form's filter with the following:
ctlKeyIn.Parent.Filter = "[TiesToTracer]=" & Me.Controls("TiesToTracer").Value
The above line caused the Sub-Form_Current() execution jump that then wipes
out the old instance.

Any ideas on how to code this to prevent the loss of the main-form?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top