SetValue action in Macro?

J

Jeff

I am attempting to use the SetValue action in a macro to
update a Date/Time field in a table. My hope is to have
the macro trigger on the 'After Update' event on a form.
How do I do this? The purpose of this action is so I have
a Date/Time for any updates to any of the fields on a
form. I will gladly do it a different way if you have a
suggestion.
This is what I have which doesn't function correctly:
Macro: UpdateEditDate
Action: SetValue
Item: [Movie Inventory]![EditDate]
Expression: Now()
Form: Movie Inventory
Form Property (After Update): UpdateEditDate
Error Message:
The object doesn't contain the Automation object 'Movie
Inventory.'
You tried to run a Visual Basic procedure to set a
property or method for an object. However, the component
doesn't make the property or method available for
Automation operations.
Check the component's documentation for information on the
properties and methods it makes available for Automation
operations.
OK
Thanks in advance for your support.
Jeff
 
K

Ken Snell

Change the Item string to this:

EditDate

or to

Forms![Movie Inventory]![EditDate]
 
S

Steve Schapel

Jeff,

[Movie Inventory]![EditDate] doesn't really make sense. I think you
just need [EditDate] in the Item argument of the macro. Also, I would
use the Before Update event, not the After Update event.

- Steve Schapel, Microsoft Access MVP
 
J

Jeff

Thanks Ken.
That worked for updating my table, but for some reason it
locks the form to the record that has been updated. I can
reopen the form and alls well unless I update a record via
the form, then it updates the record and updates the
EditDate, but lock the form to the record. Hope you
understand my meaning. Any suggestions?
Thanks
Again
Jeff
-----Original Message-----
Change the Item string to this:

EditDate

or to

Forms![Movie Inventory]![EditDate]
--
Ken Snell
<MS ACCESS MVP>

Jeff said:
I am attempting to use the SetValue action in a macro to
update a Date/Time field in a table. My hope is to have
the macro trigger on the 'After Update' event on a form.
How do I do this? The purpose of this action is so I have
a Date/Time for any updates to any of the fields on a
form. I will gladly do it a different way if you have a
suggestion.
This is what I have which doesn't function correctly:
Macro: UpdateEditDate
Action: SetValue
Item: [Movie Inventory]![EditDate]
Expression: Now()
Form: Movie Inventory
Form Property (After Update): UpdateEditDate
Error Message:
The object doesn't contain the Automation object 'Movie
Inventory.'
You tried to run a Visual Basic procedure to set a
property or method for an object. However, the component
doesn't make the property or method available for
Automation operations.
Check the component's documentation for information on the
properties and methods it makes available for Automation
operations.
OK
Thanks in advance for your support.
Jeff


.
 
J

Jeff

Placed the macro in befor update and all well.
Thanks for you assistance.
Jeff
-----Original Message-----
Thanks Ken.
That worked for updating my table, but for some reason it
locks the form to the record that has been updated. I can
reopen the form and alls well unless I update a record via
the form, then it updates the record and updates the
EditDate, but lock the form to the record. Hope you
understand my meaning. Any suggestions?
Thanks
Again
Jeff
-----Original Message-----
Change the Item string to this:

EditDate

or to

Forms![Movie Inventory]![EditDate]
--
Ken Snell
<MS ACCESS MVP>

Jeff said:
I am attempting to use the SetValue action in a macro to
update a Date/Time field in a table. My hope is to have
the macro trigger on the 'After Update' event on a form.
How do I do this? The purpose of this action is so I have
a Date/Time for any updates to any of the fields on a
form. I will gladly do it a different way if you have a
suggestion.
This is what I have which doesn't function correctly:
Macro: UpdateEditDate
Action: SetValue
Item: [Movie Inventory]![EditDate]
Expression: Now()
Form: Movie Inventory
Form Property (After Update): UpdateEditDate
Error Message:
The object doesn't contain the Automation object 'Movie
Inventory.'
You tried to run a Visual Basic procedure to set a
property or method for an object. However, the component
doesn't make the property or method available for
Automation operations.
Check the component's documentation for information on the
properties and methods it makes available for Automation
operations.
OK
Thanks in advance for your support.
Jeff


.
.
 
J

Jeff

Thanks.
It is working fine now.
Jeff
-----Original Message-----
Jeff,

[Movie Inventory]![EditDate] doesn't really make sense. I think you
just need [EditDate] in the Item argument of the macro. Also, I would
use the Before Update event, not the After Update event.

- Steve Schapel, Microsoft Access MVP


I am attempting to use the SetValue action in a macro to
update a Date/Time field in a table. My hope is to have
the macro trigger on the 'After Update' event on a form.
How do I do this? The purpose of this action is so I have
a Date/Time for any updates to any of the fields on a
form. I will gladly do it a different way if you have a
suggestion.
This is what I have which doesn't function correctly:
Macro: UpdateEditDate
Action: SetValue
Item: [Movie Inventory]![EditDate]
Expression: Now()
Form: Movie Inventory
Form Property (After Update): UpdateEditDate
Error Message:
The object doesn't contain the Automation object 'Movie
Inventory.'
You tried to run a Visual Basic procedure to set a
property or method for an object. However, the component
doesn't make the property or method available for
Automation operations.
Check the component's documentation for information on the
properties and methods it makes available for Automation
operations.
OK
Thanks in advance for your support.
Jeff

.
 
J

Jeff

Thanks Vin. I'm good now.
Jeff
-----Original Message-----
Try full reference for Item

Forms![Movie Inventory]![EditDate]

--
HTH
Van T. Dinh
MVP (Access)



Jeff said:
I am attempting to use the SetValue action in a macro to
update a Date/Time field in a table. My hope is to have
the macro trigger on the 'After Update' event on a form.
How do I do this? The purpose of this action is so I have
a Date/Time for any updates to any of the fields on a
form. I will gladly do it a different way if you have a
suggestion.
This is what I have which doesn't function correctly:
Macro: UpdateEditDate
Action: SetValue
Item: [Movie Inventory]![EditDate]
Expression: Now()
Form: Movie Inventory
Form Property (After Update): UpdateEditDate
Error Message:
The object doesn't contain the Automation object 'Movie
Inventory.'
You tried to run a Visual Basic procedure to set a
property or method for an object. However, the component
doesn't make the property or method available for
Automation operations.
Check the component's documentation for information on the
properties and methods it makes available for Automation
operations.
OK
Thanks in advance for your support.
Jeff


.
 
C

Chris M.

Jeff,

One more suggestion...

I had a heck of time figuring this one out myself. It
sounds as if your field is on a subform. I've gotten that
error message when the field I'm trying to set is on the
subform.

Use the expression builder to define the field in
the "Item" argument of the SetValue command. Here is how
I do it:

1. Open the form in design view. If your field is on a
subform, then be sure to open the MAIN form with the
subform in it.

2. Open the macro in design view and go to the Item
argument.

3. Select the ... for expression builder

4. Select your field under "Forms", "Loaded Forms" and be
sure you select the right form (i.e., select the subform
under the main form if your field is on the subform)

That should work

Chris
 

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