MkIIISupra
Programmer
I created the code below for a function that I am building up to but I can't get to the next segment because the silly thing Locks up Access! What I have is a table with 3 fields and then I have a form that is supported by the table. On the form are 2 Unbound Text boxes used to recieve input.
txtPassWord
txtMbrName
The table – tblPassFail has three fields –
passWord
mbrName
accessLvl
As you can see in the code below I am doing a simple If statement to compare the Unbound Text Fields with the Table Fields. It works on the first record but I can’t seem to get the silly thing to loop through and end the way I want it too. I got some of the code ideas from the BOF, EOF Properties Example (Microsoft Access) help file. I am using MS Access 97 on a WinNT 4.0 Svce pack 6+?.
Private Sub btnSubmit_Click()
On Error GoTo Err_btnSubmit_Click
' Database and Record variables
Dim dbs As Database
Dim rst As Recordset
' Set the Database and Recordset variables active to current tblPassFail
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("tblPassFail"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
' Find Info in the system done with a loop
Do Until rst.EOF
If (Me.txtPassWord) = Me.passWord Then
If (Me.txtMbrName) = Me.mbrName Then
lblMessage.Caption = Me.passWord & " " & Me.mbrName
Else
rst.MoveNext
End If
lblMessage.Caption = "You are not authorized access to this application."
End If
Loop
Exit_btnSubmit_Click:
Exit Sub
Err_btnSubmit_Click:
MsgBox Err.Description
Resume Exit_btnSubmit_Click
End Sub
Again many Thanks!
GSM1(SW)J. T. McDonald USN One by one the penguins steal my sanity!
txtPassWord
txtMbrName
The table – tblPassFail has three fields –
passWord
mbrName
accessLvl
As you can see in the code below I am doing a simple If statement to compare the Unbound Text Fields with the Table Fields. It works on the first record but I can’t seem to get the silly thing to loop through and end the way I want it too. I got some of the code ideas from the BOF, EOF Properties Example (Microsoft Access) help file. I am using MS Access 97 on a WinNT 4.0 Svce pack 6+?.
Private Sub btnSubmit_Click()
On Error GoTo Err_btnSubmit_Click
' Database and Record variables
Dim dbs As Database
Dim rst As Recordset
' Set the Database and Recordset variables active to current tblPassFail
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("tblPassFail"
' Find Info in the system done with a loop
Do Until rst.EOF
If (Me.txtPassWord) = Me.passWord Then
If (Me.txtMbrName) = Me.mbrName Then
lblMessage.Caption = Me.passWord & " " & Me.mbrName
Else
rst.MoveNext
End If
lblMessage.Caption = "You are not authorized access to this application."
End If
Loop
Exit_btnSubmit_Click:
Exit Sub
Err_btnSubmit_Click:
MsgBox Err.Description
Resume Exit_btnSubmit_Click
End Sub
Again many Thanks!
GSM1(SW)J. T. McDonald USN One by one the penguins steal my sanity!