R
Rob
Here's what I'm trying to do
1) open a recordset RS based on a SQL query on a single table T. The
RS should have 3 fields: T.pk (long, primary key), T.fld1 (a text
field), and calcFld, a numeric field which will be updated later. I
did this:
Set RS = CurrentDb.OpenRecordset("select pk, fld1, 0 as calcFld
from T")
2) Go through RS record by record and update calcFld based on a
user-defined function UDF
With RS
.Edit
Do While NOT .EOF
!calcFld = UDF( !fld1 ) <----------- Error occurs here
.MoveNext
Loop
.Update
End With
3) Find the 5 (say) records in RS with the greatest value in calcFld
Trouble is I cannot update the calcFld field (I get an error 3164).
The DataUpdatable property is false, but the other two fields are
updatable. I put in a 0 for the value just as a placeholder. That's
probably not the right way to do things...
How can I force that calcFld to be updatable?
Thanks in advance!
1) open a recordset RS based on a SQL query on a single table T. The
RS should have 3 fields: T.pk (long, primary key), T.fld1 (a text
field), and calcFld, a numeric field which will be updated later. I
did this:
Set RS = CurrentDb.OpenRecordset("select pk, fld1, 0 as calcFld
from T")
2) Go through RS record by record and update calcFld based on a
user-defined function UDF
With RS
.Edit
Do While NOT .EOF
!calcFld = UDF( !fld1 ) <----------- Error occurs here
.MoveNext
Loop
.Update
End With
3) Find the 5 (say) records in RS with the greatest value in calcFld
Trouble is I cannot update the calcFld field (I get an error 3164).
The DataUpdatable property is false, but the other two fields are
updatable. I put in a 0 for the value just as a placeholder. That's
probably not the right way to do things...
How can I force that calcFld to be updatable?
Thanks in advance!