Add data to the current record of a form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I would like to add a user ID to the current record. I know I can do that by
adding a bound field to the current form. Since I don't want to show it I
can make it invisibile. This works fine. However, the drawback is that I
cluter the form with fields that are not shown, and I need to do a
columnhidden = true to turn it off in datasheet view.

I tried several ways in vba, but they all get run time errors. I've tried
lines like:
Me.Form.Recordset!Creator = ShowUser
or
Me.Recordset!Creator = ShowUser
or
Me.Form.Recordset.Creator = ShowUser

where ShowUser is a function I built to return a user ID. However, none of
these lines seem to work. Is there a way to add information to the current
recordset without adding a control to the form?
 
You can still refer to a field in the form's RecordSource, even if it has no
control on the form. Just:
Me!Creator = ShowUser

Access uses a data type called AccessField for this kind of object, and the
only exposed property of the object is its Value.
 
Back
Top