SetValue using macros

S

Stryder09

I would like to have a macro set a word into a form field is this possible?
I've been asked to create a database for our supervisors to use when an
Employee is absent. I have a table with 5 fields to populate. Date, Shift,
Employee, Reason, Comments. I want them to click a button from a main form
that will put a different reason into the Reason field. (ex. Bereavement,
sick, so on and so on). So back to my question, is it possible to create a
macro that by push of a button named Bereavement open the form with the
Reason field already populated saying Bereavement. Then tomorrow they click
the sick button and the form opens up with the Reason Field populated with
sick?
 
S

Stryder09

Thought I should add some more information. I've tried to use Set VAlue in
macros but can't get it to work.

In Item I have [Forms]![frmE-Shift(New)]![Reasons].[DefaultValue]

but what do I put into the Expressions field so that it will type
Bereavement into the field when the form loads.

Thanks.
 
S

Steve Schapel

Stryder,

The entry in the Expressions property would be:
"Bereavement"

But actually, there is no need to use the Default Value for this. I
wouldn't. Just write the value directly to the field itself, so the Item
expression can simply be:
[Forms]![frmE-Shift(New)]![Reasons]

By the way, it is not a good idea to use characters such as '-' or '(' or
')' as you have in the name of your form, and I would suggest this be
changed.

Also, 'date' is a Reserved Word (i.e. has a special meaning) in Access, and
should not be used as the name of a field or control.

--
Steve Schapel, Microsoft Access MVP


Stryder09 said:
Thought I should add some more information. I've tried to use Set VAlue
in
macros but can't get it to work.

In Item I have [Forms]![frmE-Shift(New)]![Reasons].[DefaultValue]

but what do I put into the Expressions field so that it will type
Bereavement into the field when the form loads.

Thanks.

Stryder09 said:
I would like to have a macro set a word into a form field is this
possible?
I've been asked to create a database for our supervisors to use when an
Employee is absent. I have a table with 5 fields to populate. Date,
Shift,
Employee, Reason, Comments. I want them to click a button from a main
form
that will put a different reason into the Reason field. (ex.
Bereavement,
sick, so on and so on). So back to my question, is it possible to create
a
macro that by push of a button named Bereavement open the form with the
Reason field already populated saying Bereavement. Then tomorrow they
click
the sick button and the form opens up with the Reason Field populated
with
sick?
 
K

KARL DEWEY

what do I put into the Expressions field so that it will type Bereavement
into the field when the form loads.
Try --- "Bereavement"
Use 5 buttons or Option Group is better to call one of five macro OR macro
with five actions of SetValue with condition from the Option Group.


--
Build a little, test a little.


Stryder09 said:
Thought I should add some more information. I've tried to use Set VAlue in
macros but can't get it to work.

In Item I have [Forms]![frmE-Shift(New)]![Reasons].[DefaultValue]

but what do I put into the Expressions field so that it will type
Bereavement into the field when the form loads.

Thanks.

Stryder09 said:
I would like to have a macro set a word into a form field is this possible?
I've been asked to create a database for our supervisors to use when an
Employee is absent. I have a table with 5 fields to populate. Date, Shift,
Employee, Reason, Comments. I want them to click a button from a main form
that will put a different reason into the Reason field. (ex. Bereavement,
sick, so on and so on). So back to my question, is it possible to create a
macro that by push of a button named Bereavement open the form with the
Reason field already populated saying Bereavement. Then tomorrow they click
the sick button and the form opens up with the Reason Field populated with
sick?
 
S

Stryder09

Thanks for the response Karl twice. I did put "Bereavement" in the
expressions field but when the form opens the selection field is still blank,
however when I click field properties it shows bereavement in the
DefaultValue but it is there without quotations and doesn't show up on the
table either.

KARL DEWEY said:
into the field when the form loads.
Try --- "Bereavement"
Use 5 buttons or Option Group is better to call one of five macro OR macro
with five actions of SetValue with condition from the Option Group.


--
Build a little, test a little.


Stryder09 said:
Thought I should add some more information. I've tried to use Set VAlue in
macros but can't get it to work.

In Item I have [Forms]![frmE-Shift(New)]![Reasons].[DefaultValue]

but what do I put into the Expressions field so that it will type
Bereavement into the field when the form loads.

Thanks.

Stryder09 said:
I would like to have a macro set a word into a form field is this possible?
I've been asked to create a database for our supervisors to use when an
Employee is absent. I have a table with 5 fields to populate. Date, Shift,
Employee, Reason, Comments. I want them to click a button from a main form
that will put a different reason into the Reason field. (ex. Bereavement,
sick, so on and so on). So back to my question, is it possible to create a
macro that by push of a button named Bereavement open the form with the
Reason field already populated saying Bereavement. Then tomorrow they click
the sick button and the form opens up with the Reason Field populated with
sick?
 
S

Stryder09

Use 5 buttons or Option Group is better to call one of five macro OR macro
with five actions of SetValue with condition from the Option Group.

I'm not sure what you meant by the above though?

KARL DEWEY said:
into the field when the form loads.
Try --- "Bereavement"
Use 5 buttons or Option Group is better to call one of five macro OR macro
with five actions of SetValue with condition from the Option Group.


--
Build a little, test a little.


Stryder09 said:
Thought I should add some more information. I've tried to use Set VAlue in
macros but can't get it to work.

In Item I have [Forms]![frmE-Shift(New)]![Reasons].[DefaultValue]

but what do I put into the Expressions field so that it will type
Bereavement into the field when the form loads.

Thanks.

Stryder09 said:
I would like to have a macro set a word into a form field is this possible?
I've been asked to create a database for our supervisors to use when an
Employee is absent. I have a table with 5 fields to populate. Date, Shift,
Employee, Reason, Comments. I want them to click a button from a main form
that will put a different reason into the Reason field. (ex. Bereavement,
sick, so on and so on). So back to my question, is it possible to create a
macro that by push of a button named Bereavement open the form with the
Reason field already populated saying Bereavement. Then tomorrow they click
the sick button and the form opens up with the Reason Field populated with
sick?
 

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