I had an MS Access database (2003) version running on XP. I have recently upgraded to Windows7 with MS Access 2010. There is some code used that was designed to populate a text field with the data located above, until it reached the next string of text.
Here is the code as it was
Public Sub FillClaims()
Dim rst As Recordset
Dim strClaim As String
Set rst = CurrentDb.OpenRecordset("AutoTableImport")
rst.MoveLast
rst.MoveFirst
strClaim = rst("Claim")
For i = 0 To rst.RecordCount - 1
If IsNull(rst("Claim")) Then
rst.Edit
rst("Claim") = strClaim
rst.Update
End If
strClaim = rst("Claim")
rst.MoveNext
Next i
rst.Close
Set rst = Nothing
Beep
Beep
MsgBox "Fill Claims Done", vbExclamation
End Sub
The error message I get is – Compile Error: Method or data member not found
When I change the data member to EditMode (see below)
Public Sub FillClaims()
Dim rst As Recordset
Dim strClaim As String
Set rst = CurrentDb.OpenRecordset("AutoTableImport")
rst.MoveLast
rst.MoveFirst
strClaim = rst("Claim")
For i = 0 To rst.RecordCount - 1
If IsNull(rst("Claim")) Then
rst.EditMode
rst("Claim") = strClaim
rst.Update
End If
strClaim = rst("Claim")
rst.MoveNext
Next i
rst.Close
Set rst = Nothing
Beep
Beep
MsgBox "Fill Claims Done", vbExclamation
End Sub
I get a new error message-Compile error: Invalid use of property
Any thoughts on how to properly code this in Access 2010 so I can keep the needed functionality?
Here is the code as it was
Public Sub FillClaims()
Dim rst As Recordset
Dim strClaim As String
Set rst = CurrentDb.OpenRecordset("AutoTableImport")
rst.MoveLast
rst.MoveFirst
strClaim = rst("Claim")
For i = 0 To rst.RecordCount - 1
If IsNull(rst("Claim")) Then
rst.Edit
rst("Claim") = strClaim
rst.Update
End If
strClaim = rst("Claim")
rst.MoveNext
Next i
rst.Close
Set rst = Nothing
Beep
Beep
MsgBox "Fill Claims Done", vbExclamation
End Sub
The error message I get is – Compile Error: Method or data member not found
When I change the data member to EditMode (see below)
Public Sub FillClaims()
Dim rst As Recordset
Dim strClaim As String
Set rst = CurrentDb.OpenRecordset("AutoTableImport")
rst.MoveLast
rst.MoveFirst
strClaim = rst("Claim")
For i = 0 To rst.RecordCount - 1
If IsNull(rst("Claim")) Then
rst.EditMode
rst("Claim") = strClaim
rst.Update
End If
strClaim = rst("Claim")
rst.MoveNext
Next i
rst.Close
Set rst = Nothing
Beep
Beep
MsgBox "Fill Claims Done", vbExclamation
End Sub
I get a new error message-Compile error: Invalid use of property
Any thoughts on how to properly code this in Access 2010 so I can keep the needed functionality?