关于vb中循环中固定一个值,求想法。。。。。
各位大大们,代码如下
If Format(Now, "hh:mm") < onwork_time Then
Text3.Text = Text3.Text & vbCrLf & "登记成功"
Text3.Text = Text3.Text & vbCrLf & "犯人编号:" & EnrollNumber
Text3.Text = Text3.Text & vbCrLf & "登记时间:" & Format(Now, "yyyy/mm/dd hh:mm:ss")
Text3.SelStart = Len(Text3.Text)
InNumber = EnrollNumber
Adodc2.RecordSource = "select *from tb_BasicInformation Where 编号=" & InNumber '字符型的是这样,如果数字可以直接跟在=号后面
Adodc2.Refresh
Adodc3.RecordSource = "select *from tb_OnWork"
Adodc3.Refresh
Adodc4.RecordSource = "select *from tb_OnWork where 编号=" & InNumber
Adodc4.Refresh
If Adodc4.Recordset.RecordCount = 0 Then '避免重复数据的重复录入
' For i = 0 To Adodc2.MaxRecords - 1
If Adodc2.Recordset.RecordCount <> 0 Then
Adodc3.Recordset.AddNew
Adodc3.Recordset.Fields(1) = Adodc2.Recordset.Fields(1)
Adodc3.Recordset.Fields(2) = InNumber
Adodc3.Recordset.Fields(4) = 0
Adodc3.Recordset.Fields(5) = Format(Now, "yyyy/mm/dd hh:mm:ss")
Adodc3.Recordset.Update
Label_WorkNum = Adodc3.Recordset.RecordCount
End If
End If
Else
Text3.Text = Text3.Text & vbCrLf & "认证成功"
Text3.Text = Text3.Text & vbCrLf & "犯人编号:" & EnrollNumber
Text3.Text = Text3.Text & vbCrLf & "认证时间:" & Format(Now, "yyyy/mm/dd hh:mm:ss")
Text3.SelStart = Len(Text3.Text)
InNumber = EnrollNumber
Adodc4.RecordSource = "select *from tb_OnWork where 编号=" & InNumber
Adodc4.Recordset.MoveNext