AHMEDRASHED
Member
- Local time
- Today, 21:50
- Joined
- Feb 2, 2020
- Messages
- 59
Hello evreyone,
How do I prevent other users in internal network To use my username and password if I saved the username and password in the tabel login as remember
My UserName have full accsess , i dont need others user to see it .
Note :- Database was shared internally in internal network 2- Other users 2 only i need simple solution because other users do not have experience on ms access or coding
My PC , and others PC Password shown Automatic same below photo :
		
		
	
	
		 
	
Thank you
	
	
	
		
 How do I prevent other users in internal network To use my username and password if I saved the username and password in the tabel login as remember
My UserName have full accsess , i dont need others user to see it .
Note :- Database was shared internally in internal network 2- Other users 2 only i need simple solution because other users do not have experience on ms access or coding
My PC , and others PC Password shown Automatic same below photo :
Thank you
		Code:
	
	
	Option Compare Database
Option Explicit
Private Sub btnChangePassword_Click()
    On Error Resume Next
    DoCmd.OpenForm "frmForgotpassword"
    If Err.Number <> 0 Then
        MsgBox "An error occurred while opening the 'frmForgotpassword' form.", vbExclamation, "Error"
        Err.Clear
    End If
End Sub
Private Sub exit_Click()
    On Error Resume Next
    Dim Response As VbMsgBoxResult
    Response = MsgBox("Do you want to Exit?", vbYesNo, "Confirm")
    
    If Response = vbYes Then
        DoCmd.Quit
        If Err.Number <> 0 Then
            MsgBox "An error occurred while trying to exit the application.", vbExclamation, "Error"
            Err.Clear
        End If
    End If
End Sub
Private Sub Form_Load()
    On Error Resume Next
    DoCmd.Maximize
    If Err.Number <> 0 Then
        MsgBox "An error occurred while maximizing the form.", vbExclamation, "Error"
        Err.Clear
    End If
End Sub
Private Sub Form_Timer()
    On Error Resume Next
    Const IDLESECONDS = 300 ' 300 seconds of idle time
    Static PrevControlName As String, PrevFormName As String, ExpiredTime
    Dim ActiveFormName As String, ActiveControlName As String, ExpiredSeconds
    
    ActiveFormName = Screen.ActiveForm.Name
    If Err Then
        ActiveFormName = "No Active Form"
        Err.Clear
    End If
    
    ActiveControlName = Screen.ActiveControl.Name
    If Err Then
        ActiveControlName = "No Active Control"
        Err.Clear
    End If
    
    If (PrevControlName = "") Or (PrevFormName = "") _
        Or (ActiveFormName <> PrevFormName) _
        Or (ActiveControlName <> PrevControlName) Then
        PrevControlName = ActiveControlName
        PrevFormName = ActiveFormName
        ExpiredTime = 0
    Else
        ExpiredTime = ExpiredTime + Me.TimerInterval
    End If
    
    ExpiredSeconds = ExpiredTime / 1000
    If ExpiredSeconds >= IDLESECONDS Then
        ExpiredTime = 0
        On Error GoTo ErrorHandler
        Application.Quit ' Quit the application after 300 seconds of idle time
        On Error GoTo 0
    End If
    
    Exit Sub
ErrorHandler:
    MsgBox "An error occurred while trying to quit the application.", vbExclamation, "Error"
End Sub
Private Sub cmdLogin_Click()
    If IsNull(userName) Or IsNull(password) Or userName = "" Or password = "" Then
        MsgBox "Please enter your name!"
        Exit Sub
    ElseIf Not password = DLookup("password", "tlogin", "userID = " & txtID) Then
        message = "Wrong password . Please write the correct info..!"
        Exit Sub
    ElseIf password = DLookup("password", "tlogin", "userID = " & txtID) Then
        If IsNull(DLookup("startup", "tstartupForm", "startupID =1")) Then
            DoCmd.CLOSE
            DoCmd.OpenForm "frmSettings"
        Else
            DoCmd.SetWarnings False
            DoCmd.RunSQL "UPDATE tTemp Set userID = " & Me.txtID
            DoCmd.CLOSE
            Dim srt As String
            srt = DLookup("startup", "tstartupForm", "startupID =1")
            DoCmd.OpenForm srt
        End If
    End If
End Sub
Private Sub password_AfterUpdate()
    On Error Resume Next
    Me.Refresh
    If Err.Number <> 0 Then
        MsgBox "An error occurred while refreshing the form.", vbExclamation, "Error"
        Err.Clear
    End If
    On Error GoTo 0
End Sub
Private Sub userName_AfterUpdate()
On Error Resume Next
Dim db As Database
Dim rst As Recordset
Set db = CurrentDb()
Set rst = db.OpenRecordset("Select * from tlogin where userID =" & userName)
   If rst!remember = True Then
        txtID = rst!userID
        Me.password = rst!password
        message = ""
    Else
        txtID = rst!userID
        message = ""
        Me.password = ""
    End If
End Sub
Private Sub userName_NotInList(NewData As String, Response As Integer)
    ' Suppress the default error message
    Response = acDataErrContinue
    ' User not found, display a custom message
    message = "User not found"
End Sub
			
				Last edited: 
			
		
	
								
								
									
	
		
			
		
		
	
	
	
		
			
		
		
	
								
							
							 
	 
 
		
 
 
		 
 
		 
 
		