default fields

  • Thread starter George Applegate
  • Start date
G

George Applegate

I have a table and I would like to add two or three fields to it.
Most users would never see these fields or even know they were there.
What I would like to do is somehow if anyone did maintenance to a
record, write the date and time and signed on user (of the PC???) who
did the maintenance.

Now do I have to do this as an action on the maintenance form, or is
there a way to do this at the table level itself? I'd love to somehow
be able to do it at the table level instead of some action on a form.

Is that possible? Also, either way, at the table level or as an
action on a form, can someone help me with the macro or code I would
need to accomplish this?

thanks,
ga
George Applegate
(e-mail address removed)
 
J

John W. Vinson

I have a table and I would like to add two or three fields to it.
Most users would never see these fields or even know they were there.
What I would like to do is somehow if anyone did maintenance to a
record, write the date and time and signed on user (of the PC???) who
did the maintenance.

Now do I have to do this as an action on the maintenance form, or is
there a way to do this at the table level itself? I'd love to somehow
be able to do it at the table level instead of some action on a form.

Is that possible? Also, either way, at the table level or as an
action on a form, can someone help me with the macro or code I would
need to accomplish this?

You'll need to do it on a form (and use Access security, if need be, to ensure
that users only have update access via the Form).

In the Form's BeforeUpdate event you can populate the fields:

Private Sub Form_BeforeUpdate(Cancel as Integer)
<do any validation of the record first>
<if the record is ok to add...>
Me!txtWhenUpdated = Now
Me!txtByWhom = GetUser()
End Sub
 
T

Tom van Stiphout

On Sun, 08 Jun 2008 14:23:00 -0500, George Applegate

No, that's not possible with an Access (better: Jet) database. Unlike
SQL Server, which has triggers that can be used for this purpose.
Write your code in the Form_AfterUpdate event.

-Tom.
 

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

Top