【发布时间】:2012-09-01 18:11:53
【问题描述】:
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 的新手。我真的需要帮助
【问题讨论】:
-
你能至少标出错误发生的源代码行吗?
-
欢迎来到 StackOverflow。我没有看到这里被问到问题。您没有描述问题,没有标记有问题的代码部分,也没有提出任何问题。请编辑您的问题以提供一些信息,以便我们尝试帮助您解决您遇到的任何问题。
-
错误发生在 Me.aTbName = rs!Full_Name
-
看不出该代码有什么问题。请贴出
Me.aTbName的定义。 -
他的意思是让你从你的代码中发布 aTbName 的定义;它是如何声明的?通常,在 VB6 中,这是 DIM 语句,除非 aTbName 可能是表单上的文本框(或其他控件)的名称。
标签: properties vb6