vb6.0中总是提示 RS1 As Recordset用户定义类型未定义
PrivateSubCommand1_Click()OnErrorGoTo100IfText1.Text=""ThenMsgBox"请输入序号",1+16,"出错提示"T...
Private Sub Command1_Click()
On Error GoTo 100
If Text1.Text = "" Then
MsgBox "请输入序号", 1 + 16, "出错提示"
Text1.SetFocus
Else
Dim RS1 As Recordset
Dim DB1 As Database
Set DB1 = OpenDatabase("\\192.168.1.254\2车间生产条码\BACK\zb.mdb", False, False, "MS Access;pwd=123")
Set RS1 = DB1.OpenRecordset(name:="数据源", Type:=dbOpenDynaset)
RS1.FindFirst "序号=" & Text1.Text & ""
If RS1.NoMatch = True Then
MsgBox "对不起,没有查到序号为:" & Text1.Value & " 的相关信息"
RS1.Close
Exit Sub
Else
Text2.Text = RS1.Fields("单号").Value
Text3.Value = RS1.Fields("长").Value
Text4.Value = RS1.Fields("宽").Value
Text5.Value = RS1.Fields("玻璃").Value
End If
RS1.Close
Set RS1 = Nothing
Set DB1 = Nothing
End If
Exit Sub '正常执行结束,跳出 sub
100:
MsgBox Err.Description, 1 + 16, "系统提示"
End Sub
我尝试引用了Microsoft ActiveX Data Object2.8 Library 然而并没有什么卵用 展开
On Error GoTo 100
If Text1.Text = "" Then
MsgBox "请输入序号", 1 + 16, "出错提示"
Text1.SetFocus
Else
Dim RS1 As Recordset
Dim DB1 As Database
Set DB1 = OpenDatabase("\\192.168.1.254\2车间生产条码\BACK\zb.mdb", False, False, "MS Access;pwd=123")
Set RS1 = DB1.OpenRecordset(name:="数据源", Type:=dbOpenDynaset)
RS1.FindFirst "序号=" & Text1.Text & ""
If RS1.NoMatch = True Then
MsgBox "对不起,没有查到序号为:" & Text1.Value & " 的相关信息"
RS1.Close
Exit Sub
Else
Text2.Text = RS1.Fields("单号").Value
Text3.Value = RS1.Fields("长").Value
Text4.Value = RS1.Fields("宽").Value
Text5.Value = RS1.Fields("玻璃").Value
End If
RS1.Close
Set RS1 = Nothing
Set DB1 = Nothing
End If
Exit Sub '正常执行结束,跳出 sub
100:
MsgBox Err.Description, 1 + 16, "系统提示"
End Sub
我尝试引用了Microsoft ActiveX Data Object2.8 Library 然而并没有什么卵用 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询