Leave filters active until the form is closed

Anonymous
2023-01-12T13:46:07.1566667+00:00

Hello,

I have the following problem: When opening my form, a password request is made via VBA which activates a filter to display only orders of the respective employee.
Now I want to filter by the order number in the form. However, everyone can also enter the order numbers of the other colleagues and receive the results. Is there any possibility that the filter after the employee remains active until you close the form again?

This is my code for password protection:


I am grateful for any help

Greetings Caro

Access
Access
A family of Microsoft relational database management systems designed for ease of use.
333 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Anonymous
    2023-01-12T13:49:23+00:00
    
    Private Sub Form_open(Cancel As Integer)
    
        Select Case InputBox("Passwort eingeben", "Passwortabfrage")
            'DAH
            Case "55DAH"
                Me.Filter = "[Bearbeiter PL]= 'DAH' And [Abgerechnet]= False"
                Me.FilterOn = True
    
            'PAV
            Case "99PAV"
                Me.Filter = "[Bearbeiter PL]= 'PAV' And [Abgerechnet]= False"
                Me.FilterOn = True
            'PASSWORTVERGABE ENDE
            Case Else
                MsgBox "Falsch"
                DoCmd.Close acForm, Me.Name
        End Select
    End Sub
    
    
    0 comments No comments