I have created a standard module called "PublicLogin"
Option Compare Database
' setting up the public variables for the User and the Branch
Option Explicit
Public pintUserId As Integer
Public ptxtUserCode As String
Public pintBranchId As Integer
Public ptxtBranchCode As String
I have also created a small login form called LoginFrm
I ask for the Branch, for the User Code and their password.
The following code is on the 'on click' event on the LoginButt
Private Sub LoginButt_Click()
'Check that Branch and UserCode have been selected
If IsNull(Me.BranchCodeFld) Then
MsgBox "You need to select a Branch!", vbCritical
Me.BranchCodeFld.SetFocus
Else
If IsNull(Me.UserCodeFld) Then
MsgBox "You need to select a user!", vbCritical
Me.UserCodeFld.SetFocus
Else
'Check for correct password
If Me.PasswordFld = Me.UserCodeFld.Column(3) Then
'Check if password needs to be reset
If Me.UserCodeFld.Column(4) = True Then
pintUserId = Me.UserCodeFld.Column(0)
pintBranchId = Me.BranchCodeFld.Column(0)
ptxtUserCode = Me.UserCodeFld.Column(1)
ptxtBranchCode = Me.BranchCodeFld.Column(1)
DoCmd.OpenForm "frmPasswordChange", , , "[UserID] = " & Me.UserIdFld
End If
pintUserId = Me.UserCodeFld.Column(0)
pintBranchId = Me.BranchCodeFld.Column(0)
ptxtUserCode = Me.UserCodeFld.Column(1)
ptxtBranchCode = Me.BranchCodeFld.Column(1)
MsgBox (pintUserId & pintBranchCode & ptxtUserCode & ptxtBranchCode)
DoCmd.OpenForm "TogasMenu"
Me.Visible = False
Else
MsgBox "Password does not match, please re-enter!", vboOkOnly
Me.PasswordFld = Null
Me.PasswordFld.SetFocus
End If
End If
End If
End Sub
The first 'pintUserId' gives me Compiler Error - Ambiguous name detected
Question 1. how do I activate the standard module PublicLogin - how do I get the variables declared and in memory.
Question 2. Do I need to somehow execute the standard module in the LoginFrm ?
This is probably a simple concept but I have read a lot of posts but as yet I haven't been able to come to grips with it.
Thank you in anticipation
Option Compare Database
' setting up the public variables for the User and the Branch
Option Explicit
Public pintUserId As Integer
Public ptxtUserCode As String
Public pintBranchId As Integer
Public ptxtBranchCode As String
I have also created a small login form called LoginFrm
I ask for the Branch, for the User Code and their password.
The following code is on the 'on click' event on the LoginButt
Private Sub LoginButt_Click()
'Check that Branch and UserCode have been selected
If IsNull(Me.BranchCodeFld) Then
MsgBox "You need to select a Branch!", vbCritical
Me.BranchCodeFld.SetFocus
Else
If IsNull(Me.UserCodeFld) Then
MsgBox "You need to select a user!", vbCritical
Me.UserCodeFld.SetFocus
Else
'Check for correct password
If Me.PasswordFld = Me.UserCodeFld.Column(3) Then
'Check if password needs to be reset
If Me.UserCodeFld.Column(4) = True Then
pintUserId = Me.UserCodeFld.Column(0)
pintBranchId = Me.BranchCodeFld.Column(0)
ptxtUserCode = Me.UserCodeFld.Column(1)
ptxtBranchCode = Me.BranchCodeFld.Column(1)
DoCmd.OpenForm "frmPasswordChange", , , "[UserID] = " & Me.UserIdFld
End If
pintUserId = Me.UserCodeFld.Column(0)
pintBranchId = Me.BranchCodeFld.Column(0)
ptxtUserCode = Me.UserCodeFld.Column(1)
ptxtBranchCode = Me.BranchCodeFld.Column(1)
MsgBox (pintUserId & pintBranchCode & ptxtUserCode & ptxtBranchCode)
DoCmd.OpenForm "TogasMenu"
Me.Visible = False
Else
MsgBox "Password does not match, please re-enter!", vboOkOnly
Me.PasswordFld = Null
Me.PasswordFld.SetFocus
End If
End If
End If
End Sub
The first 'pintUserId' gives me Compiler Error - Ambiguous name detected
Question 1. how do I activate the standard module PublicLogin - how do I get the variables declared and in memory.
Question 2. Do I need to somehow execute the standard module in the LoginFrm ?
This is probably a simple concept but I have read a lot of posts but as yet I haven't been able to come to grips with it.
Thank you in anticipation