Access 2003 -- getting a macro to set a field value to the default

A

AccessBob98101

I have a database that tracks items being exchanged a quarterly basis. Within
this info are some fields I use on a temporary basis to remind me when a
person needs to be cancelled form receiving the item the next quarter.

There are six fields, three yes/no, one date and two text. I have been able
to rest the yes/no value to a default of No.

But I get an error message saying I can't reset the value of the other
fields to a default of " " (zero length or blank field) because the object or
control doesn't allow for such automation.

The expression builder lets me put in changing the value but the eroor
message doesn't after I run it.

Hope this isn't too confusing. I would appreciate any help in this. I can't
seem to find the specific subject with the MS help search pages.

Thank you.
 
S

Steve Schapel

Bob,

You forgot to mention what you are doing to get this error. So I guess I am
only guessing that you are using a SetValue avtion in a macro.

I can't understnad why you would wnat to set the value of a field to " " or
"" because if you want to clear the data from a field, you would set it to
Null.
 
A

AccessBob98101

Thanks for your reply, Steve.

I am using the SetValue property to try to clear the date and text fields
since they are for temporary use.

I have tried setting the default properties to Null or " ", and having the
SetValue reset the field to the default with no success. I have also used
Delete and Null in the expression with no successs.

My expression reads:

[Forms]![frmCancelBadge]![CancelledDate],
[Forms]![frmCancelBadge]![CancelledDate].[Null]


I get the following erro message:

"The object doesn't contain the Automation Object "Null" (or Delete or
Default). You tried to run a visual basic procedure or method for an object.
Hovever the component ddoesn't make the the property available for
automation."

I am using Access 2003.

Bob
 
S

Steve Schapel

Bob,

The arguments for the SetValue action would be like this:

Item: [CancelledDate]
Expression: Null

I am not clear on your meaning when you refer to "default", but let me point
out that the Default Value preoperty of a control only comes into play at
the point where a new record is being first created, so is propably not
relevant in your scenario.
 
A

AccessBob98101

Thank you for your help. It works.

Seems I was trying too much info.

Bob


Steve Schapel said:
Bob,

The arguments for the SetValue action would be like this:

Item: [CancelledDate]
Expression: Null

I am not clear on your meaning when you refer to "default", but let me point
out that the Default Value preoperty of a control only comes into play at
the point where a new record is being first created, so is propably not
relevant in your scenario.

--
Steve Schapel, Microsoft Access MVP


AccessBob98101 said:
Thanks for your reply, Steve.

I am using the SetValue property to try to clear the date and text fields
since they are for temporary use.

I have tried setting the default properties to Null or " ", and having the
SetValue reset the field to the default with no success. I have also used
Delete and Null in the expression with no successs.

My expression reads:

[Forms]![frmCancelBadge]![CancelledDate],
[Forms]![frmCancelBadge]![CancelledDate].[Null]


I get the following erro message:

"The object doesn't contain the Automation Object "Null" (or Delete or
Default). You tried to run a visual basic procedure or method for an
object.
Hovever the component ddoesn't make the the property available for
automation."

I am using Access 2003.
 

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