Office中国论坛/Access中国论坛

标题: [原创]登陆问题? [打印本页]

作者: snowflying    时间: 2006-5-3 22:29
标题: [原创]登陆问题?
请教各位高手:

我想在登陆窗体中选择用户名,输入密码后,点击确定按钮,就进入工时输入窗体(只显示该部门的员工)

请大家帮我看看这段代码哪里错误了?

例如:选择车身一室,输入密码3110,“提示错误:除非控件获得焦点,否则您不能引用该控件的属性或方法”

这是怎么回事啊,情大家多多帮忙啊?

谢谢!

[此贴子已经被作者于2006-5-3 14:39:04编辑过]


作者: andymark    时间: 2006-5-3 22:36
你用了文本框的text属性,把它去掉

如Text0.Text 直接用Text0就可以了


作者: snowflying    时间: 2006-5-3 22:41
哦,谢谢!

我上传的那个文件怎么看不见啊,在哪里呢?
作者: snowflying    时间: 2006-5-3 22:49
组合框呢,是不是也要把combo.text 改为combo啊?
作者: 一点通    时间: 2006-5-3 22:52
按"回复",将你的文件用WINRAR打包后传上来看下
作者: snowflying    时间: 2006-5-3 23:00
我把text去掉了,提示“您输入的表达式引用了一个关闭或不存在的对象“

怎么回事啊

Private Sub cmdok_Click()

On Error GoTo err_cmdok_click
Dim rs As ADODB.Recordset
Dim str As String
Dim num As Integer
Dim username As String
Dim password As String
  username = Trim(combo7)
password = Trim(text2)
Set rs = New ADODB.Recordset
   If IsNull(username) Then
   DoCmd.Beep
   MsgBox ("lease choose username")
   If IsNull(password) Then
   DoCmd.Beep
   MsgBox ("lease input password")
   
   Else
     str = "select * from 登陆表 where 登陆表.部门名称='" & username & "'and 登陆表.密码='" & password & "'"
   
Set rs = GetRs(str)  

If rs.EOF Then
    DoCmd.Beep
    MsgBox ("lease input ")
    combo7 = ""                                                     

    text2 = ""
    text2.SetFocus
     End If
   End If


Exit Sub
     Else
       DoCmd.Close
       Me![cmdok].SetFocus
       MsgBox ("wlecome to this systerm")
       check = True
       DoCmd.OpenForm ("工时输入窗体")
      

       '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




欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/) Powered by Discuz! X3.3