Datestamp based on field

William Demuth

Registered User.
Local time
Today, 11:36
Joined
Feb 16, 2011
Messages
35
I have a table with a field called "Close Reason" that starts out blank. I have a second field called "Date Closed" which also starts out blank

This field is used on a form called "Opportunity Details" via combo box. (The form is based of a querry that calls the table up)

When someone changes "close reason" with a selection from a drop down box, I want to insert the date into "Date Closed"

I suspect I need something on "After update", and have tried

"=[Opportunities]![Date Closed]=Now()"

This generates an error :banghead:

It says the object dosen't contain the automation object "Opportunities"

What am I doing wrong?
 
The correct format for the command is as follows:

me.[date closed]=now()

(me. is a shorthand notation for the current form assuming that the combo box and the date closed controls are on the same form)
 
Thank you for trying to help. Your solution seems logical but it isn't working

I do not have a "date closed" control on the form (i do not want anyone to see it)

I just want the field in the table updated?

Any hints??
 
I have a second field called "Date Closed" which also starts out blank. This field is used on a form called "Opportunity Details" via combo box.
The field is on the form.
I do not have a "date closed" control on the form
The field is not on the form. Those can't both be correct.

To handle an event in code, which is what you probably need to do, then type or select '[Event Procedure]' from the dropdown in the After Update property of the control whose event you'd like to handle. Click the ellipsis (...), the three dots on the far right of the AfterUpdate field and a code window should open with signature of the VBA code that will handle the event.

After that it matters if the [Date Closed] field is on the form. It's easier if it is on the form, and note that a control bound to a field will have a visible property that you can use to hide it from users. Otherwise you'll have to write some SQL to update the data in the table.

But those are the first steps to handling an event, and updating data when some other data is updated.

Cheers,
 
If the field is on the form, use jzwp22's code. If it's not you need to write an update query.
 

Users who are viewing this thread

Back
Top Bottom