FilterOn = False

ybg1

Registered User.
Local time
Today, 11:45
Joined
Jan 3, 2009
Messages
20
Hello,

I have a main form with a continuous subform. I am filtering the subform
by using the following code from the main form and it works fine.

Private Sub Form_Current()
strWhere = "[Seder_Code]=" & G_Seder & " AND " & "[Bahoor_Code]=" & G_NameCode
Me.SubFormFines.Form.Filter = strWhere
Me.SubFormFines.Form.FilterOn = True
End Sub

The problem starts when I try to enter details on the continuous subform.
For example when I have filtered 3 records and I want to amend the third record the cursor jumps to the first line.

I've realized that it happens because the subform is still on FilterOn = True

I would like to turn off the filter and to be able to change the details on the subform and still having only the 3 records that have been filtered before.

Where can I switch off the filter and how?

Thanks
 
Turning FilterOn to False isn't going to keep just the 3 records. It is jumping because you are filtering in the main form's On Current event. Why do you need to do that? What is the connection between the main form and the subform. It should be set up so that you just navigate to a record on the main form and then it would automatically filter the subform to fit whatever the master/child links were set. So, if those fields you are filtering the subform by are not in the main form's record source, I would be trying to figure out why as it would appear that you wouldn't have the table structure set correctly (potentially).
 
Thanks for the reply,

The Main Form has the general details of the person, and the subform consists of several events related to him.
I'm coming to the main form from anther continuous form that has numeros people.
Thanks
 
The subforms should then be tied together with a common PersonID field then. And the Master/Child links set to that.
 
The subforms is tied together with a common PersonID field but I want to filter some events on the subform and not to see all of them
 
The subforms is tied together with a common PersonID field but I want to filter some events on the subform and not to see all of them
So why not set the subform's Record Source to a query which pulls those events. It isn't like it will show the others ever since the code you are using is on the main form's On Current event.
 
I've tried to use a query by using the - Forms!MainForm!Field - and it didn't work as it was not there
 
It wouldn't be fields on the main form (unless G_NameCode and G_Seder are from the main form)
 
You are right, Initially I'd passed that info to the main form but later I've use the General Modules fields.
 
I've used a different method .
I've cancelled the main Form and turned the subform ito a Main Form and used the following:
strWhere = "[Seder_Code]=" & G_Seder & " AND " & "[Bahoor_Code]=" & G_NameCode
DoCmd.OpenForm "Fines", , , strWhere
and it works fine.
Thank you

progress.gif
 

Users who are viewing this thread

Back
Top Bottom