filter records

rainbows

Registered User.
Local time
Today, 14:13
Joined
Apr 21, 2017
Messages
428
hi the code below is what I use for the administrator to open the form issue list
what I need Help with is

there are 3 administrators who passwords are CH1 , SK1, AND EW1
at this time the table shows ALL the issue raised by the 3 companies ie API , API CAP , AND PPI-ENG

so I would like it that if the password is CH1 the only the records for PPI-ENG are shown , of EW1 is selected then only API records are shown etc

thanks for your help

steve
Dim strInput As String Dim strMsg As String Beep strMsg = "Please Enter the password to allow access." strInput = InputBox(Prompt:=strMsg, Title:="Admin Password") If strInput = "CH1" Then 'MsgBox "Password accepted! Welcome! " & "Ellen " 'password is correct DoCmd.OpenForm "issue list" DoCmd.Maximize DoCmd.Close acForm, Me.Name Else 'password is incorrect MsgBox "Incorrect Password!" & vbCrLf & vbLf & "You are not allowed access to the ''issue list''.", vbCritical, "Invalid Password" Exit Sub End If End Sub
 
Whilst you could hard code these values, it would be better to look up the user names and passwords from a table so that if you add or remove users your code doesn't need to change.

You could control this with a login form where you would set a user code and simply look up what they can access and the reporting they can see. Review http://www.mendipdatasystems.co.uk/password-login/4594469149
 
You can use the WHERE parameter of openform to limit the records that can be used. However despite being called WHERE it is actually a filter - so a user could remove the filter and see all the records so you would need to disable the users ability to filter the form

From your description it looks like there is no relationship between the password and issue type so more information required to explain how you do this. Otherwise you will need a case or if..else Statement to define the relationship

I would take minty’s advice
 
thanks Minty. I am not really good enough to do anything like that , so I thought someones help with the macro would be easier for someone to help me and I understand the hard code issue
 
the users Use a Different form and can only access there own forms. admin see all the records in another form at this time to monitor "just in time" , whats completed , percentage late , early etc etc
 
thanks Minty. I am not really good enough to do anything like that , so I thought someones help with the macro would be easier for someone to help me and I understand the hard code issue
No time like the present to learn?
Create a table and put the PW and Company into records. People normally use a userID.? What happens when you need to change a PW? However this setup will cater for that as well.

Use a DCount to see if the PW is valid.
If it is use another DlookUp() to get the relevant company.

From there, you are on your own as you have not shown anything else on which to advise on?
 

Users who are viewing this thread

Back
Top Bottom