I am receiving an error stating that there is a Loop without a Do. I am not sure where the fault lies, because there is a Do
Private Sub Command28_Click()
On Error GoTo Err_MyProc
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim UserIDVar As Variant
Dim Perm As Variant
UserIDVar = Me.txt_StoreUserID
Set db = CurrentDb()
Set rst = db.OpenRecordset("SELECT RoleID FROM x_UserRoleAssign WHERE UserID =" & UserIDVar, dbOpenDynaset)
Do While Not rst.EOF
Perm = rst("RoleID")
If Perm = 1 Then
Me.cmd_BusUser.Enabled = True
End If
If Perm = 2 Then
Me.cmd_HelpDesk.Enabled = True
End If
If Perm = 3 Then
Me.cmd_TechUser.Enabled = True
End If
If Perm = 4 Then
Me.cmd_ManUser.Enabled = True
If Perm = 5 Then
Me.cmd_AdminUser.Enabled = True
End If
rst.MoveNext
Loop
db.Close
rst.Close
Exit_MyProc:
Set rst = Nothing
Set db = Nothing
Exit Sub
Err_MyProc:
MsgBox "Error Message to Follow"
Resume Exit_MyProc
End Sub