I have a query fueling a form. The properties show that the query is Dynamic. In the code behind the form, I set a recordset and do some work. After scrolling thru the recordset, I then update fields on the form. When I try to set me!txtfield.value = variable determined in code, I get a runtime error 3226 for a recordset that cannot be updated. I've tried opening the recordset as Dynamic {didnt think it would help} and it still gives me the error. I know what the problem is, but I don't see where there's an error. Any ideas?
Here's the code:
Dim RS As Recordset
Dim Outs As Double
Dim Pricer As Double
Dim Outb As Double
Outs = 0
Outb = 0
Pricer = 0
DoCmd.SetWarnings False
DoCmd.Close acTable, "TblFgnBreakdown"
DoCmd.OpenQuery "QmakFgnBreakDown"
Set RS = CurrentDb.OpenRecordset("TblFgnBreakdown", dbOpenDynaset)
If RS.RecordCount > 0 Then
RS.MoveFirst
Do Until RS.EOF
If RS!Status <> "Verified" Then
Outs = Outs + RS!ShareAmt
End If
RS.MoveNext
Loop
Pricer = Me!TxtPrice.Value
Outb = (Outs * Pricer)
Me!TxtOutsBal.Value = (Outs * Pricer)
Me!TxtOutsShs.Value = Outs
Else
Me!TxtOutsBal.Value = 0
Me!TxtOutsShs.Value = 0
End If
Set RS = Nothing
DoCmd.Close acTable, ("TblFgnBreakDown"
Does it have to do with the variables being "Double"? I need them as Double b/c we have to calculate to 5 decimal places, but the field on the form is "Standard" to show 5 decimals.
Thanks for your time!
Here's the code:
Dim RS As Recordset
Dim Outs As Double
Dim Pricer As Double
Dim Outb As Double
Outs = 0
Outb = 0
Pricer = 0
DoCmd.SetWarnings False
DoCmd.Close acTable, "TblFgnBreakdown"
DoCmd.OpenQuery "QmakFgnBreakDown"
Set RS = CurrentDb.OpenRecordset("TblFgnBreakdown", dbOpenDynaset)
If RS.RecordCount > 0 Then
RS.MoveFirst
Do Until RS.EOF
If RS!Status <> "Verified" Then
Outs = Outs + RS!ShareAmt
End If
RS.MoveNext
Loop
Pricer = Me!TxtPrice.Value
Outb = (Outs * Pricer)
Me!TxtOutsBal.Value = (Outs * Pricer)
Me!TxtOutsShs.Value = Outs
Else
Me!TxtOutsBal.Value = 0
Me!TxtOutsShs.Value = 0
End If
Set RS = Nothing
DoCmd.Close acTable, ("TblFgnBreakDown"
Does it have to do with the variables being "Double"? I need them as Double b/c we have to calculate to 5 decimal places, but the field on the form is "Standard" to show 5 decimals.
Thanks for your time!