设为首页收藏本站Access中国

Office中国论坛/Access中国论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

返回列表 发新帖
查看: 2032|回复: 9
打印 上一主题 下一主题

[宏/菜单/工具栏] [求助]请教多用户按权限登陆问题?

[复制链接]
1#
发表于 2006-5-8 22:11:00 | 显示全部楼层
'看看这样行了吗?我调整了判断语句的位置,其它的没有变化。
'再者你GetRs函数中没有代码,故不能测试

Private Sub cmdok_Click()

   On Error GoTo err_cmdok_click
   Dim Rs As ADODB.Recordset
   Dim str As String
   Dim i As Integer
   Dim username As String
   Dim password As String

   username = Trim(combo7.Value)
   password = Trim(text2.Value)
   Set Rs = New ADODB.Recordset
   i = i + 1

   
   If IsNull(username) Then
      DoCmd.Beep
      MsgBox ("请选择用户名!")
      Exit Sub
   End If

   If IsNull(password) Then
      DoCmd.Beep
      MsgBox ("请输入密码!")
      Exit Sub
   End If


   str = "select * from 登陆表 where 登陆表.部门名称='" & username & "'and 登陆表.密码='" & password & "'"

   Set Rs = GetRs(str)

   If Rs.EOF Then
      DoCmd.Beep
      If i < 3 Then
         MsgBox ("请重新输入! ")
         'combo7 = ""

         text2 = ""
         text2.SetFocus
      Else
         MsgBox ("密码错误!对不起,您无权进入本系统!")
      End If



      Exit Sub
   Else
      ' DoCmd.Close
      Me![cmdok].SetFocus
      MsgBox ("欢迎使用工时统计系统!")
      check = True
      DoCmd.OpenForm "窗体1"


      'DoCmd.OpenForm "工时输入窗体", , , "[部门] = 'combo7'"
   End If

Set Rs = Nothing
Set conn = Nothing


exit_cmdok_click:

Exit Sub
err_cmdok_click:
MsgBox Err.Description
Resume exit_cmdok_click


End Sub
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|站长邮箱|小黑屋|手机版|Office中国/Access中国 ( 粤ICP备10043721号-1 )  

GMT+8, 2024-5-18 11:21 , Processed in 0.157775 second(s), 24 queries .

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表