Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

putting values in a field

0 views
Skip to first unread message

Square One

unread,
Jun 12, 2003, 1:41:43 PM6/12/03
to
I want to write a for next loop, activated by a cammand
button, that goes through a table and evaluates a field,
if the value is null i want the value from the previos
record put in that field. i get the for next thing and
the if then thing i just don't know how to put the value
in the field. and i'm considering TPing jeffrey p.
mcmanus' house.

Dean

unread,
Jun 12, 2003, 4:15:28 PM6/12/03
to
Dim mRS as recordset
Dim defaultVal as string
defaultVal = "Some Value"
Set mRS = currentdb.OpenRecordset(myTablename)
With mRS
.movefirst
While not .EOF
if Not IsNull(.fields(fieldname)) then
'if the field has a value then assing value to
variable
defaultVal = .fields(fieldname)
Else
'If field value is empty then assign variable
value to field
.Edit
.fields(fieldname) = defaultVal
.Update
End if
.movenext
Wend
End With
mRS.close
set mRS = Nothing

- - - Dean

>.
>

0 new messages