vb新手提问 求找错 哪里错了 ?跪求!求如何改正
本帖最后由 bcrun 于 2012-08-29 10:25:15 编辑
Private Sub Command1_Click()
Dim sq2 As String
Dim sq1 As String
Dim time1 As Integer
Dim time2 As Integer
Dim yue As Double
Dim feiyong As Double
Dim n As Integer '定义变量
Dim num As String
Dim cheku As Integer
num = Text1.Text
If Text1.Text = "" Then
MsgBox "没有刷卡,请刷卡", , "提示"
Else
Data1.Recordset.FindFirst "卡号 = '" & num & "'" '查找符合条件的第一条记录
If Data1.Recordset.NoMatch = True Then '没有找到记录
MsgBox "此用户不存在!", , "提示"
Text1.Text = ""
Else
If Data1.Recordset.Fields(4) < 0 Then
MsgBox "你卡上金额不足,请充值。"
Text1.Text = ""
Exit Sub
Else
Data2.Recordset.AddNew
Data2.Recordset.Fields(1).Value = num
Data2.Recordset.Fields(2).Value = Data1.Recordset.Fields(4).Value
Data2.Recordset.Fields(3).Value = Format(time, "hh:mm:ss")
Data2.Recordset.Fields(4).Value = Combo1.Text
Data2.Recordset.Fields(5).Value = "普通用户"
Data2.Recordset.Update
sq1 = "select count(*) as 人数 from 停车"
sq2 = "select count(*) as 人数 from 出车"
n = sq1 - sq2
Text2.Text = Data1.Recordset.Fields(4).Value
Text3.Text = ""
Text4.Text = Data2.Recordset.Fields(3).Value
Text5.Text = ""
Text6.Text = n
MsgBox "此用户已进入车库", , "提示"
Exit Sub
End If
End If
End If
End Sub
Private Sub Command2_Click()
Dim sq2 As String
Dim sq1 As String
Dim time As Integer
Dim yue As Double
Dim feiyong As Double
Dim n As Integer '定义变量
Dim num As String
Dim cheku As Integer
num = Text1.Text
If num = "" Then
MsgBox "没有刷卡,请刷卡", , "提示"
Else
Data2.Recordset.FindFirst "卡号 = '" & num & "' " '查找符合条件的第一条记录
If Data1.Recordset.NoMatch Then '没有找到记录
MsgBox "此用户不在浴室!", , "提示"
Text1.Text = ""
Exit Sub
Else
time = Data3.Recordset.Fields(2).Value - Data2.Recordset.Fields(3).Value
Data3.Recordset.AddNew
Data3.Recordset.Fields(1).Value = num
Data3.Recordset.Fields(2).Value = Format(time, "hh:mm:ss")
Data3.Recordset.Fields(3).Value = Combo1.Text
Data3.Recordset.Fields(4).Value = time * 2
Data3.Recordset.Fields(5).Value = Data2.Recordset.Fields(2).Value - Data3.Recordset.Fields(4).Value
Data2.Recordset.Update
sq1 = "select count(*) as 人数 from 停车"
sq2 = "select count(*) as 人数 from 出车"
n = sq1 - sq2
Text2.Text = Data1.Recordset.Fields(4).Value
Text3.Text = Data3.Recordset.Fields(4).Value
Text4.Text = Data2.Recordset.Fields(3).Value
Text5.Text = Data3.Recordset.Fields(2).Value
Text6.Text = n
MsgBox "此用户已出浴室", , "提示"
Exit Sub
If Data3.Recordset.Fields(5).Value <= 0 Then
MsgBox "你卡上金额不足,请充值。"
Exit Sub
End If
End If
End If
End Sub
[解决办法]
太长了,没有这么多时间来看你的代码,最好把出错中断的代码指示出来,才有人帮你解决。
[解决办法]
错误是啥?