源子程序如下:
Private Sub Add_Fields(ByVal str As String)
Dim MyConStr As String
Dim UserCount As Integer
Dim Mycn As New ADODB.Connection
Dim Myrs As New ADODB.Recordset
 MyConStr = "Provider=Microsoft.Jet.OLEDB.4.0;" _
            & "Data Source=" & App.Path & "\PL2000.mdb"
 Mycn.Open MyConStr
 Mycn.CursorLocation = adUseClient
 Myrs.Open "Select * From 表1 Property", Mycn, adOpenKeyset, adLockPessimistic
 
 Myrs.MoveLast
    
' Myrs.UpdateBatch adAffectAllChapters
  ' Myrs.EditMode
  
  If str = "name" Then
    Myrs.Fields("姓名") = NameText.Text
  End If
  
  If str = "sex" Then
    Myrs.Fields("性别") = Combo1.Text
  End If
  
  If str = "age" Then
    Myrs.Fields("年龄") = Val(AgeText.Text)
    
  End If
  
  
  
  
' Myrs.UpdateBatch adAffectAllChapters
  Myrs.Update
 
 'r = MsgBox("添加成功!", 48, "操作结果")
 Myrs.Close
 
End Sub
这段程序的主要功能是当输入姓名,年龄,性别时,按下保存键时将这几个字段的值填到当前的记录中去.
但是在系统第一次运行是老是报错,错误信息如下:
-----------------------------------------------------------------------------------
运行时错误 '-2147467259(8000040005)
键列信息不足或不正确更新影响到多行
------------------------------------------------------------------------------------
但是再次运行程序,添加时又不报错了,请问这是什么问题?应该如何解决呢?谢了.



											
	    

	