ACCESS问题:用户定义类型未定义 10
OptionExplicitDimmy_recordsetAsrecordsetPrivateSubForm_Load()mainfrm.ShowEndSubPrivat...
Option Explicit
Dim my_recordset As recordset
Private Sub Form_Load()
mainfrm.Show
End Sub
Private Sub comm_cancal_click()
End
End Sub
Private Sub Comm_ok_Click()
Dim local_sql As String
Dim user_name As String
Dim password As String
Dim connect_string As String
Dim connect As connection
Dim tagl As Integer
tag1 = 0
Set connect = New connection
Set my_recordset = New recordset
'连接Access数据库
connect_string = "DSN=db1;UID=admin;PSW="
connect.open connect_string
'查找用户名
user_name = Text1.Text
password = Text2.Text
local_sql = "select 用户名 from 用户表" + -"Where 用户表.用户名 = " + " '" + -user_name + "'"
my_recordset.open local_sql, connect
If Not (my_recordset.bof And my_recordset.EOF) Then
'表中有此用户
my_recordset.Close
local_sql = "select 密码from用户表" + -"Where 用户表.用户名 = " + " '" + user_name + "'and" + -"用户表.密码 = " + " '" + password + "'"
my_recordset.open local_sql, connert
If Not (my_recordset.bof And my_recordset.EOF) Then
'此用户的密码正确
Unload loginfrm
If user_name = "administrator" Then
'系统管理员
mainfrm.menu_user.Enabled = True
Else
mainfrm.menu_user.Enabled = False
End If
Else '用户输入的密码不正确
MsgBox "您输入的密码不正确,请重新输入!!", , "警告"
End If
Else
MsgBox "系统中无此用户", , "警告"
End If
End Sub
老说我用户定义类型未定义!!!!!那位大虾帮我看 下啊! 展开
Dim my_recordset As recordset
Private Sub Form_Load()
mainfrm.Show
End Sub
Private Sub comm_cancal_click()
End
End Sub
Private Sub Comm_ok_Click()
Dim local_sql As String
Dim user_name As String
Dim password As String
Dim connect_string As String
Dim connect As connection
Dim tagl As Integer
tag1 = 0
Set connect = New connection
Set my_recordset = New recordset
'连接Access数据库
connect_string = "DSN=db1;UID=admin;PSW="
connect.open connect_string
'查找用户名
user_name = Text1.Text
password = Text2.Text
local_sql = "select 用户名 from 用户表" + -"Where 用户表.用户名 = " + " '" + -user_name + "'"
my_recordset.open local_sql, connect
If Not (my_recordset.bof And my_recordset.EOF) Then
'表中有此用户
my_recordset.Close
local_sql = "select 密码from用户表" + -"Where 用户表.用户名 = " + " '" + user_name + "'and" + -"用户表.密码 = " + " '" + password + "'"
my_recordset.open local_sql, connert
If Not (my_recordset.bof And my_recordset.EOF) Then
'此用户的密码正确
Unload loginfrm
If user_name = "administrator" Then
'系统管理员
mainfrm.menu_user.Enabled = True
Else
mainfrm.menu_user.Enabled = False
End If
Else '用户输入的密码不正确
MsgBox "您输入的密码不正确,请重新输入!!", , "警告"
End If
Else
MsgBox "系统中无此用户", , "警告"
End If
End Sub
老说我用户定义类型未定义!!!!!那位大虾帮我看 下啊! 展开
2个回答
展开全部
Dim tagl As Integer
tag1 = 0
你声明变量的是 小写字母 l
而你赋值的时候就变成 数字 1 了
tag1 = 0
你声明变量的是 小写字母 l
而你赋值的时候就变成 数字 1 了
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
。。。。。
MsgBox
"欢迎使用稀里糊涂系统!",
vbInformation,
"成功"
lcount
=
0
DoCmd.Close
Else
msfbox
"密码有误!"
+
Chr(13)
+
Chr(13)
&
3
-
lcount
&
"次机会",
'msfbox=MsgBox
????
这里
vbCritical,
"警告"
End
If
Else
MsgBox
"用户名有误!"
+
Chr(13)
+
Chr(13)
&
3
-
lcount
&
"次机会",
vbCritical,
"警告"
End
If
。。。。。。
MsgBox
"欢迎使用稀里糊涂系统!",
vbInformation,
"成功"
lcount
=
0
DoCmd.Close
Else
msfbox
"密码有误!"
+
Chr(13)
+
Chr(13)
&
3
-
lcount
&
"次机会",
'msfbox=MsgBox
????
这里
vbCritical,
"警告"
End
If
Else
MsgBox
"用户名有误!"
+
Chr(13)
+
Chr(13)
&
3
-
lcount
&
"次机会",
vbCritical,
"警告"
End
If
。。。。。。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询