我运行vb时 连接数据库失败 点击出现实时错误91 对象变量或with块未设置 但我没用with块啊
PrivateSubMDIForm_Load()DimrstAsADODB.RecordsetDimsqlAsStringDimstokens()AsStringDimm...
Private Sub MDIForm_Load()
Dim rst As ADODB.Recordset
Dim sql As String
Dim stokens() As String
Dim msg As String
Dim rights As String '保存记录中的权限值
'查找权限
sql = " select 权限 from 用户表 where 用户ID ='" & userid & " '"
Set rst = selectsql(sql, msg)
If rst.RecordCount > 0 Then
rights = Trim(rst.Fields(0))
rst.Close
Else
MsgBox ("没有用户信息!")
Exit Sub
End If
'设置权限
If InStr(rights, "资料管理") Then
资料管理.Enabled = True
Me.Toolbar1.Buttons(1).Enabled = True
Me.Toolbar1.Buttons(2).Enabled = True
Else
资料管理.Enabled = False
Me.Toolbar1.Buttons(1).Enabled = False
Me.Toolbar1.Buttons(2).Enabled = False
End If
If InStr(rights, "采购管理") Then
采购管理.Enabled = True
Me.Toolbar1.Buttons(3).Enabled = True
Me.Toolbar1.Buttons(4).Enabled = True
Else
采购管理.Enabled = False
Me.Toolbar1.Buttons(3).Enabled = False
Me.Toolbar1.Buttons(4).Enabled = False
End If
If InStr(rights, "销售管理") Then
销售管理.Enabled = True
Me.Toolbar1.Buttons(5).Enabled = True
Me.Toolbar1.Buttons(6).Enabled = True
Else
销售管理.Enabled = False
Me.Toolbar1.Buttons(5).Enabled = False
Me.Toolbar1.Buttons(6).Enabled = False
End If
库存管理.Enabled = InStr(rights, "库存管理")
统计分析.Enabled = InStr(rights, "统计分析")
用户管理.Enabled = InStr(rights, "用户管理")
End Sub
请高手指点下 小弟刚学vb 做毕业设计 时间狠急急急 展开
Dim rst As ADODB.Recordset
Dim sql As String
Dim stokens() As String
Dim msg As String
Dim rights As String '保存记录中的权限值
'查找权限
sql = " select 权限 from 用户表 where 用户ID ='" & userid & " '"
Set rst = selectsql(sql, msg)
If rst.RecordCount > 0 Then
rights = Trim(rst.Fields(0))
rst.Close
Else
MsgBox ("没有用户信息!")
Exit Sub
End If
'设置权限
If InStr(rights, "资料管理") Then
资料管理.Enabled = True
Me.Toolbar1.Buttons(1).Enabled = True
Me.Toolbar1.Buttons(2).Enabled = True
Else
资料管理.Enabled = False
Me.Toolbar1.Buttons(1).Enabled = False
Me.Toolbar1.Buttons(2).Enabled = False
End If
If InStr(rights, "采购管理") Then
采购管理.Enabled = True
Me.Toolbar1.Buttons(3).Enabled = True
Me.Toolbar1.Buttons(4).Enabled = True
Else
采购管理.Enabled = False
Me.Toolbar1.Buttons(3).Enabled = False
Me.Toolbar1.Buttons(4).Enabled = False
End If
If InStr(rights, "销售管理") Then
销售管理.Enabled = True
Me.Toolbar1.Buttons(5).Enabled = True
Me.Toolbar1.Buttons(6).Enabled = True
Else
销售管理.Enabled = False
Me.Toolbar1.Buttons(5).Enabled = False
Me.Toolbar1.Buttons(6).Enabled = False
End If
库存管理.Enabled = InStr(rights, "库存管理")
统计分析.Enabled = InStr(rights, "统计分析")
用户管理.Enabled = InStr(rights, "用户管理")
End Sub
请高手指点下 小弟刚学vb 做毕业设计 时间狠急急急 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询