Macro that adds 1 to a record

  • Thread starter Thread starter Steve
  • Start date Start date
S

Steve

Hi all,
i am designing a database which will envolve the sale of
can crisps and popcorn for film showings, does anyone know
if there is a way to make a macro that adds 1 to a record,
eg a button to add 1 pack of crisps to a persons tab.
thanks very much
Steve
 
Steve,

Depending on the details of what you are doing, you could take one of
these macro-based approaches...
1. Use a SetValue action to set the value of [YourField] to [YourField]+1
2. Make an Update Query to update the value of [YourField] to
[YourField]+1 and then use an OpenQuery action in your macro to run this
Update.
 
i think i am going to go for the 1 option, what would be
the expression, i have it set up so that all the pupils
names are in a table with the record of how many cans and
crisps etc they have bought
thanks for your help
Steve
-----Original Message-----
Steve,

Depending on the details of what you are doing, you could take one of
these macro-based approaches...
1. Use a SetValue action to set the value of [YourField] to [YourField]+1
2. Make an Update Query to update the value of [YourField] to
[YourField]+1 and then use an OpenQuery action in your macro to run this
Update.

--
Steve Schapel, Microsoft Access MVP

Hi all,
i am designing a database which will envolve the sale of
can crisps and popcorn for film showings, does anyone know
if there is a way to make a macro that adds 1 to a record,
eg a button to add 1 pack of crisps to a persons tab.
thanks very much
Steve
.
 
Steve,

Make a macro using the SetValue action. The Item argument will be the
equivalent of...
[YourField]
.... where YourField is the name of the field you want to increment, and
the Expression argument will be...
[YourField]+1

Put this macro on the applicable event on your data form. I can't
advise specifically, because I can't imagine what you are doing, so you
will need to decide at what point the value will be incremented. Maybe
you will have a command button on the form, so it will be the On Click
event of the button where you need to assign the macro.
 
Back
Top