A
Afrosheen
Thanks for reading my post.
Before I start, sometimes when I post on this forum and I get a reply I can
not open it up to view the reply. So I'm sorry in advance if I don't reply
back. I really need to see the answers so it will give me direction and
guidence.
Now to the problem.
I have a password form with 3 unbound text boxes. The usual User Id,
Password, and if the level is not high enough the third box is supposed to
ask for the users name. Entering the user id and password work ok. When it
comes to checking the level of the user it goes beyond the third text box. It
does display but it doesn't stop to ask the name. Someone suggested that I
use an input box which is ok, but I know that the third text box being unhid
will or should work. I'm open to any suggestions. Maybe I'm doing something
wrong. Here is the code for the whole program:
Private Sub Form_Load()
Me.Text8.Visible = False
End Sub
'---------------------------------------------------------------------------------------
' Procedure : Pword_AfterUpdate
' Author : XXXXXXXX
' Date : 10/15/2008
' Purpose : This is the password sectio
'---------------------------------------------------------------------------------------
'
Private Sub Pword_AfterUpdate()
Dim strUser, userpermission, Text8 As String
Dim rst As DAO.Recordset ' The tLogError table
10 strUser = username
Static counter As Integer
20 If StrComp(Me.Pword, Nz(DLookup("Password", "tblpass", "User=" & """"
& strUser & """"), ""), 0) = 0 Then
30 userpermission = DLookup("[userlevel]", "[tblpass]", "[User] = '" &
strUser & "'")
40 If userpermission = 3 Then
50 Text8 = InputBox("Please Enter Your Last Name")
'60 Me.Text8.Visible = True
'70 Me.Text8.SetFocus
80 End If
90 Set rst = CurrentDb.OpenRecordset("tPassLog", , dbAppendOnly)
100 rst.AddNew
110 rst![Date] = Date
120 rst![User] = strUser
130 rst![Time] = Time()
132 rst![Uname] = Text8
140 rst.Update
150 rst.Close
160 strUser = ""
170 username = ""
180 Pword = ""
190 DoCmd.Close acForm, "frmPass2" 'Closes the password window
200 DoCmd.OpenForm "frmFileMaint", acNormal, OpenArgs:=userpermission
210 Exit Sub
220 Else
230 If counter < 2 Then
240 Call MsgBox("Oh Oh! You Didn't Say the Magic Word!!" _
& vbCrLf & "" _
& vbCrLf & "You Only Get 3 Times To Get It Right" _
, vbCritical, Application.Name)
250 strUser = ""
260 username = ""
270 Pword = ""
280 counter = counter + 1
290 Else
300 DoCmd.Close acForm, "frmPass2"
310 End If
320 End If
End Sub
Thanks again
Before I start, sometimes when I post on this forum and I get a reply I can
not open it up to view the reply. So I'm sorry in advance if I don't reply
back. I really need to see the answers so it will give me direction and
guidence.
Now to the problem.
I have a password form with 3 unbound text boxes. The usual User Id,
Password, and if the level is not high enough the third box is supposed to
ask for the users name. Entering the user id and password work ok. When it
comes to checking the level of the user it goes beyond the third text box. It
does display but it doesn't stop to ask the name. Someone suggested that I
use an input box which is ok, but I know that the third text box being unhid
will or should work. I'm open to any suggestions. Maybe I'm doing something
wrong. Here is the code for the whole program:
Private Sub Form_Load()
Me.Text8.Visible = False
End Sub
'---------------------------------------------------------------------------------------
' Procedure : Pword_AfterUpdate
' Author : XXXXXXXX
' Date : 10/15/2008
' Purpose : This is the password sectio
'---------------------------------------------------------------------------------------
'
Private Sub Pword_AfterUpdate()
Dim strUser, userpermission, Text8 As String
Dim rst As DAO.Recordset ' The tLogError table
10 strUser = username
Static counter As Integer
20 If StrComp(Me.Pword, Nz(DLookup("Password", "tblpass", "User=" & """"
& strUser & """"), ""), 0) = 0 Then
30 userpermission = DLookup("[userlevel]", "[tblpass]", "[User] = '" &
strUser & "'")
40 If userpermission = 3 Then
50 Text8 = InputBox("Please Enter Your Last Name")
'60 Me.Text8.Visible = True
'70 Me.Text8.SetFocus
80 End If
90 Set rst = CurrentDb.OpenRecordset("tPassLog", , dbAppendOnly)
100 rst.AddNew
110 rst![Date] = Date
120 rst![User] = strUser
130 rst![Time] = Time()
132 rst![Uname] = Text8
140 rst.Update
150 rst.Close
160 strUser = ""
170 username = ""
180 Pword = ""
190 DoCmd.Close acForm, "frmPass2" 'Closes the password window
200 DoCmd.OpenForm "frmFileMaint", acNormal, OpenArgs:=userpermission
210 Exit Sub
220 Else
230 If counter < 2 Then
240 Call MsgBox("Oh Oh! You Didn't Say the Magic Word!!" _
& vbCrLf & "" _
& vbCrLf & "You Only Get 3 Times To Get It Right" _
, vbCritical, Application.Name)
250 strUser = ""
260 username = ""
270 Pword = ""
280 counter = counter + 1
290 Else
300 DoCmd.Close acForm, "frmPass2"
310 End If
320 End If
End Sub
Thanks again