设为首页收藏本站Access中国

Office中国论坛/Access中国论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

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

[表] INSERT INTO

[复制链接]
跳转到指定楼层
1#
发表于 2008-5-30 16:32:27 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
Option Compare Database


Private Sub Cancel_Click()
DoCmd.Quit
End Sub
Private Sub Label16_Click()
End Sub
Private Sub OK_Click()
On Error GoTo Err_OK_Click
Dim str As String
Dim rs As New ADODB.Recordset
Dim loginuserid As String
Dim lo As Boolean
lo = True
Dim nn As Integer
nn = 1
logname = Trim(Me.UserName)
pwd = Trim(Me.PassWord)
If IsNull(logname) Then
DoCmd.Beep
MsgBox ("请输入用户名称!")
Me.UserName.SetFocus
lo = False
ElseIf IsNull(pwd) Then
DoCmd.Beep
MsgBox ("请输入密码!")
Me.PassWord.SetFocus
lo = False
End If
If lo Then
    str = "select * from tblSysUsers where FUserName= '" & logname & "' and FPassword='" & pwd & "'"
    Set rs = GetRS(str)
    If rs.EOF Then
    DoCmd.Beep
    MsgBox ("没有这个用户或输入密码,请重新输入!")
    Me.UserName = ""
    Me.PassWord = ""
    Me.Text20 = ""
    Me.UserName.SetFocus
    Exit Sub
    Else
    strUserName = logname
    sysuser = Trim(Me.Text20)
    DoCmd.RunSQL "INSERT INTO tblSysUserslogin(FUserName,loginDate,work)VALUES( &strUserName, now(),&a) "
    DoCmd.Close
    MsgBox ("欢迎使用TFCL仓库管理系统!")
    DoCmd.OpenForm "frmSysMain"
    check = True
    End If
   
    Set rs = Nothing
    Set conn = Nothing
End If
Exit_OK_Click:
    Exit Sub
Err_OK_Click:
    MsgBox (Err.Description)
    Resume Exit_OK_Click
   
End Sub
Private Sub Text20_BeforeUpdate(Cancel As Integer)
End Sub
Private Sub UserName_AfterUpdate()
On Error GoTo Err_UserName_AfterUpdate
Dim STemp As String
    If IsNull(Me![UserName]) Then
        UserID = Null
    Else
        STemp = DLookup("姓名", "userinfor", "[UserName]= '" & Me![UserName] & "'")
        If IsNull(STemp) Then
            UserID = Null
            Me![UserName] = ""
        Else
            UserID = STemp
            Me![Text20] = DLookup("姓名", "userinfor", "[员工编号]= '" & Me![UserName] & "'")
        End If
    End If
Exit_UserName_AfterUpdate:
    Exit Sub
Err_UserName_AfterUpdate:
    MsgBox "您“用户编号”输入错误,或者还没有注册,请检查!", vbCritical, "无此用户"
    Resume Exit_UserName_AfterUpdate
End Sub
Private Sub UserName_BeforeUpdate(Cancel As Integer)
On Error GoTo Err_UserName_BeforeUpdate
       If Len(Me![UserName]) <> 5 Then
        MsgBox "“用户编号”是由五位数字组成!", vbInformation, "用户编号错误"
        Cancel = True
    End If
Exit_UserName_BeforeUpdate:
    Exit Sub
Err_UserName_BeforeUpdate:
    MsgBox Err.Description
    Resume Exit_UserName_BeforeUpdate
End Sub
Private Sub UserName_LostFocus()
loginuserid = Trim(Me.UserName)
If IsNull(loginuserid) Then
DoCmd.Beep
MsgBox ("请输入用户名称!")
Me.UserName.SetFocus
lo = False
End If
End Sub
Private Sub 主体_Click()
End Sub
以上执行时DoCmd.RunSQL "INSERT INTO tblSysUserslogin(FUserName,loginDate,work)VALUES( &strUserName, now(),&a) "这条语句执行时有问题?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享分享 分享淘帖 订阅订阅
2#
发表于 2008-5-30 16:46:08 | 只看该作者
提示什么错误?是不是语法错误,去掉&试一下
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-5-21 13:27 , Processed in 0.079098 second(s), 25 queries .

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

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