I would like to record the user's name that enters new records.
To accomplish this I am thinking I need to run a macro that that updates the appropriate field but I am not sure of the best event to trigger the macro. Perhaps there is a better way.
I would like to record the user's name that enters new records.
To accomplish this I am thinking I need to run a macro that that updates the appropriate field but I am not sure of the best event to trigger the macro. Perhaps there is a better way.
One of the insert events, probably the after insert event.
After Insert is a good option - thank you. Is there a way to only apply the action to the active record? Condition?
Typically you would have the macro set a field on the form to your value, which would only apply to the active record.
If I use the Form property event - after insert
and run the macro it updates all records - I just want to update the current record
![]()
It would be helpful if you specified what actions the macro takes. It sounds like you're running an update query instead of setting a form control. If so, you probably need to add a criteria to the query.
the form enters new contacts
the update query adds name/date/time
I only want it to run on new/changed records
thanks!
Like I said, add a criteria to the query that refers to the record on the form.
If you want it to run on changed records, you probably want the after update instead of after insert event.
Dumb question - How do i do that from the query when it is run form the a macro on the form?
In the Criteria row of the query design grid, under the appropriate field(s), add a reference to the appropriate form control(s). It will look like the above, or you can right-click and select Build.
After Insert is a good option - thank you. Is there a way to only apply the action to the active record? Condition?
That's what I was thinking, do you know the criteria to use?
If you're using an update query, it needs to have a criteria. The macro condition won't have any effect on which records the update query updates. Only a criteria will.
As I mentioned before, the more common approach (presuming the target fields are in the same table the form is bound to) is to simply have these fields on the form (can be hidden) and use SetValue in your macro to place your values. They will automatically save to the table for the correct record.
I have a unrelated signIn table and a customer table
When a customer is added or changed I want to record the name of the person signed in.
I am not familiar with SetValue in a macro, I did not find it as an action option - can you give me any other information on SetValue?
I appreciate you help!
If you're not seeing it as an option, with the macro in design view click on "Show all Actions" on the ribbon. You should see it then. There should be info on it in help.