KAZZANeedsHelp
Technical User
I have an Access 2000 database.
I have a form called aDataInputF.
On this form I have 7 tabs (Pages) called
- MainP
- OperationalDetailsP
- SiteDetailsP
- StaffDetailsP
- Staff/SiteDetailsP
- TrainingCourseP
- TrainingProviderP
Except for MainP they all have forms (sub forms) on them
- OperationalDetailsP has aOperationalDetailsF
- SiteDetailsP has a6SiteDetailsF
- StaffDetailsP has aStaffDetailsF
- Staff/SiteDetailsP has sStaffSiteDetailsF
- TrainingCourseP has aTrainingCourseSubjectF
- TrainingProviderP has aTrainingProviderF
Except for aOperationalDetailsF the forms (sub forms) have
- a field called [ActInact] (the record is either Active or Inactive)
and
- toggle buttons which filter data on them
- SiteDetailsP has a6SiteDetailsF which has filtertoggle1
- StaffDetailsP has aStaffDetailsF which has filtertoggle2
- Staff/SiteDetailsP has sStaffSiteDetailsF which has filtertoggle3
- TrainingCourseP has aTrainingCourseSubjectF which has filtertoggle4
- TrainingProviderP has aTrainingProviderF which has filtertoggle5
The toggle buttons have code similar to the following (ie the name of the toggle button has changed for each form).
Please Note that both code versions work – my problem is yet to be stated.
Using the OnClick I have an Event Procedure which calls the following code:
*********************************************************
Private Sub FilterToggle1_Click()
On Error GoTo Err_FilterToggle1
Dim db As DAO.Database
Dim rs As DAO.Recordset
Me.Filter = "ActInact = 'Active'"
Me.FilterOn = Not Me.FilterToggle1.Value
Exit_FilterToggle1:
Exit Sub
Err_FilterToggle1:
MsgBox Error$
Resume Exit_FilterToggle1
End Sub
*********************************************************
I have even tried using the following code
*********************************************************
Private Sub FilterToggle1_Click()
On Error GoTo Err_FilterToggle1
Dim db As DAO.Database
Dim rs As DAO.Recordset
If FilterToggle1.Value = -1 Then
Me.FilterOn = False
Else
Me.Filter = "ActInact = 'Active'"
Me.FilterOn = True
End If
Exit_FilterToggle1:
Exit Sub
Err_FilterToggle1:
MsgBox Error$
Resume Exit_FilterToggle1
End Sub
*********************************************************
I went into each forms’ properties
Using the OnLoad I have a ‘GoToNewRecord’ macro.
Using the OnOpen I have an Event Procedure which calls the following code:
*********************************************************
Private Sub Form_Open(Cancel As Integer)
On Error GoTo Err_Form
Dim db As DAO.Database
Dim rs As DAO.Recordset
Me.Filter = "ActInact = 'Active'"
Me.FilterOn = True
Exit_Form:
Exit Sub
Err_Form:
MsgBox Error$
Resume Exit_Form
End Sub
*********************************************************
This all works and opens each form with filtered data whilst preparing it for a new record to be added.
**********************************************************************
My problem is:
**********************************************************************
When I open up the database and click on the 'aDataInputF' form I see all seven tabs.
If I click on the following Tabs to view the forms only they all show the data as filtered (which is what I want them to do).
- Site Details
- Staff Details
- Staff Site Details
- Training Course
- Training Provider
So if I click on the Site Details Tab.
The form opens as Filtered.
Click on the 'Turn Filter Off/On' Button.
Click on the 'Turn Filter Off/On' Button again.
This all works quite nicely toggling back and fourth between filtered and not filtered.
Close out of the 'aDataInputF' form.
Now if I open up the 'aDataInputF' form again.
Click on the Staff Details Tab.
The form opens as Filtered.
Click on the 'Turn Filter Off/On' Button.
Click on the 'Turn Filter Off/On' Button again.
This all works quite nicely toggling back and fourth between filtered and not filtered.
Close out of the 'aDataInputF' form.
If I doo this for each of the remaining tabs making sure I close out of the 'aDataInputF' form.
It all works quite nicely.
NOW HERE IS THE PROBLEM:
If I open up the 'aDataInputF' form.
Click on the Site Details Tab.
The form opens as Filtered.
Click on the 'Turn Filter Off/On' Button.Click on the 'Turn Filter Off/On' Button again.
This all works quite nicely toggling back and fourth between filtered and not filtered.
But if I DO NOT close out of the 'aDataInputF' form and then
Click on the Staff Details Tab
The form does not open as Filtered. Why is this so????????? It is like first sub form is affecting the rest.
Click on the 'Turn Filter Off/On' Button.
Click on the 'Turn Filter Off/On' Button again.
The filtering starts to work again.
This all works quite nicely toggling back and fourth between filtered and not filtered.
DO NOT close out of the 'aDataInputF' form.
Do this for each of the remaining tabs making sure you do not close out of the 'aDataInputF' form.
The sub forms do not open up as filtered (the way they should).
Can you help me with this one?
Regards
Karen Day