Unanswered: Type Mismatch error when pulling previous record value.
I have searched for recordset information and pulled code from various posts. I am trying to pull my form's previuos record of [Balance] and transfer that to the corrent recordsets field of [CalcField].
With the code I have found I get a type mismatch error.
Here is the code I have...
The Debit, Deposit, Balance, and CalcField are all Currency. Can anyone point me to the problem. I have tried specifying DAO.Recordset, but everytime I do, my computer locks and I have to End Task. I have sent the error reports to MS, They told me to update to SP3 so I did. My computer still locks if I use DAO.Recordset. So, I just left it as Recordset.
Private Sub Balance_GotFocus()
On Error GoTo Err_Balance_GotFocus
Dim rs As Recordset
Set rs = Me.RecordsetClone
rs.Bookmark = Me.Bookmark
'Move to the previous record
If Not rs.BOF Then
Test = Test + rs.Fields(strFieldName)
Me.CalcField = Test
If IsEmpty(Me.Deposit) Then
Me.Balance = Me.CalcField - Me.Debit
Me.Balance = Me.CalcField + Me.Deposit
Originally posted by izyrider
when you are referring to a field in a recordset you need the "!" operator as in:
variable = recordset!fieldName
also, your strFieldName appears to be undefined
Ok, I recreated this at work on Access 2002 instead of Access 2000 and the problem lies with in the
Dim rs As Recordset Needs to be
Dim rs As DAO.Recordset to work properly. Do you know of any issues with Access 2000 not using the DAO library correctly? I have 2 computers at home that I have tried this with and both of them lock up when I add any refference to DAO.