Record Fields Collection

  • Thread starter Thread starter Bill
  • Start date Start date
B

Bill

I'm trying to set one of the fields in the current
record, which I assume I can do if I have the
right name for the collection. I thought it was
"Fields", but either that's wrong or how I've
used it here is wrong?????

Me.Fields("SubCat" & level "ID") = lngNewID

Where the current record contains fields of:
SubCat1ID, SubCat2ID,,,,,,,,,SubCatxID.

Bill
 
Bill said:
I'm trying to set one of the fields in the current
record, which I assume I can do if I have the
right name for the collection. I thought it was
"Fields", but either that's wrong or how I've
used it here is wrong?????

Me.Fields("SubCat" & level "ID") = lngNewID

Where the current record contains fields of:
SubCat1ID, SubCat2ID,,,,,,,,,SubCatxID.


If the SubCatxID things are controls on the form or fields
in the form's record source table/query:
Me("SubCat" & level & "ID") = lngNewID
or
Me.Controls("SubCat" & level & "ID") = lngNewID
 
Thanks, I didn't realize references to fields were
of the same syntax as those for controls. Believing
they were different, I didn't even try:
Me("SubCat" & level & "ID") = lngNewID
which I use with some regularity.
Bill
 
It's kind of a shortcut where both the controls and the
recordsource fields are made properties of the form. It
really blurs the distinction between controls and fields,
but it is convenient. If a field and a control have the
same name, the controls is used.

I think the formal alternative is to go through the form's
Recordset or RecordsetClone:

Since A2K
Me.Recordset.Fields( . . .
or
Me.Recordset( . . .
or, in any version
Me.RecordsetClone( . . .
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top