Save filtered records reapply on re-open

matt beamish

Registered User.
Local time
Today, 23:21
Joined
Sep 21, 2000
Messages
215
I am working with 2 forms, one an index, and one showing detailed data for the records on the index.
My users filter the index down in a number of ways to a smaller set of records, and then choose individual records to open and edit.

I have used the stlinkcriteria to relate my 2 forms. But I want to also reapply whatever filter that user has used when they switch between the forms.

My VBA for opening the detail form from the index form is:

Code:
Private Sub Command34_Click()
On Error GoTo Err_Command34_Click

    Dim stDocName As String
    Dim stlinkcriteria As String

    stDocName = "F_Project_Summary"
    
    stlinkcriteria = "[Job_No]=" & "'" & Me![Job_No] & "'"
    DoCmd.OpenForm stDocName, , , stlinkcriteria

Exit_Command34_Click:
    Exit Sub

Err_Command34_Click:
    MsgBox Err.Description
    Resume Exit_Command34_Click
    
End Sub


The code that returns the user to the index form is this

Code:
Private Sub Command68_Click()
On Error GoTo Err_Command68_Click

    Dim stDocName As String
    Dim stlinkcriteria As String

    stDocName = "F_Project_Summary_Index_simple"
    
    stlinkcriteria = "[Job_No]=" & "'" & Me![Job_No] & "'"
           DoCmd.OpenForm stDocName
Forms(stDocName).Recordset.FindFirst stlinkcriteria
            DoCmd.Close acForm, Me.Name
      
Exit_Command68_Click:
    Exit Sub

Err_Command68_Click:
    MsgBox Err.Description
    Resume Exit_Command68_Click
    



End Sub


At the moment, the user returns to the index form and all the records are displayed. What would the code be to save the filtered set of records and reapply the filter when the index form is returned to?

Thanks very much

Matt

Matt
 

Users who are viewing this thread

Back
Top Bottom