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 錯誤發生在Me.aTbName = rs!Full_Name。你能幫我解決這個問題嗎?對不起,在這個論壇和VB中新來的。我真的需要幫助VB6錯誤中屬性的無效使用。如何解決這個問題?
你能至少標記源代碼行,哪裏出現錯誤? – arrowd
歡迎來到StackOverflow。我在這裏看不到問題。您沒有描述過問題,標記了一段代碼就是問題,或者提出了任何問題。請編輯您的問題以提供一些信息,所以我們可以嘗試並幫助您解決您遇到的任何問題。 –
錯誤發生在 Me.aTbName = rs!Full_Name –