Private Sub aTbBar_Change()
Set con = New ADODB.Connection
With con
.CursorLocation = adUseClient
.ConnectionString = "Provider=Microsoft.jet.oledb.4.0;persist security info=false;data source=" & App.Path & "\Event_Participants.accde"
.Open
End With
Set rs = New ADODB.Recordset
With rs
Set .ActiveConnection = con
.CursorType = adOpenDynamic
.Source = "select * from Participants"
.Open
'check from table if user and pwd matches
If rs.RecordCount <> 0 Then
rs.MoveFirst
While Not rs.EOF
If rs!Bar_Code_No = Val(Me.aTbBar) Then
Me.aTbName = rs!Full_Name
Me.aTbSection = rs!Section
Me.aTbArrtime = Time()
End If
rs.MoveNext
Wend
End If
.Close
Set rs = Nothing
End With
'save to the database
'check from table if user and pwd matches
Set rs = New ADODB.Recordset
With rs
Set .ActiveConnection = con
.CursorType = adOpenDynamic
.LockType = adLockOptimistic
.Source = "select * from Participants"
.Open
If rs.RecordCount <> 0 Then
rs.MoveFirst
While Not rs.EOF
If rs!Bar_Code_No = Val(Me.aTbBar) Then
.Update
rs!Arr_Time = Me.aTbArrtime
End If
rs.MoveNext
Wend
End If
End With
rs.Close
Set rs = Nothing
End Sub
当我输入到该文本框名称 aTbBar 时,总是发生 Invalid Use of Proper 错误。错误发生在 Me.aTbName = rs!Full_Name。你能帮我解决这个问题吗?对不起,我是这个论坛和 VB 的新手。我真的需要帮助