关于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
Adodc4.Refresh
For i = 0 To Adodc4.Recordset.RecordCount - 1
Adodc4.Recordset.Fields(4) = 1
If Adodc4.Recordset.EOF Then
Exit For
End If
Next i
End If
别的不用看,就是if和else,因为犯人很多,在else的时候,会有很多人一次点名,每次点都来一次,但是我只想在第一次来数据的时候将时间付给delayend_time这个变量,因为这个时间还要作为后面判断的依据,而且这个delayend_time这个变量还要能够变化,因为一天中点名的轮次还是挺多的,求解啊,小弟跪谢了