Change a field value using a macro

J

Jill

I have a good understanding of many aspects of Access so I
apologize in advance for how basic my question is:

I am working on a video rental DB. Once I select a video
title from a form I want to turn field "Video Rented" =
Yes.

I have never written a macro so I have no idea where to
even start.

Thanks for your knowledge!!!

Jill
 
T

Trent Argante

Hi Jill,
Assuming that the name of the field (i.e, data source)
is "Video Rented", then you're syntax will be:
[Video Rented] = "Yes"
BUT (and notice my big "BUT") it depends on what data type
the Video Rented field is (e.g., text, checkbox, etc.),
and what action you take that you want to automatically
update your Video Rented field from. For example, when you
click the "Rent this video" button, you want the Video
Rented field to change to "Yes".
Hope this helps, but need more info.
Trent Argante
 
S

Steve Schapel

Jill,

Go to the Macros tab on the database window, and click New. This will
open the macro design window. In the Action column, select SetValue.
After this, you will see two Argument boxes towards the bottom of the
window, labelled Item and Expression. In the Item argument, put...
[Video Rented]
.... and in the Expression argument, put...
-1
Close and save this macro, and then in the form design view, select this
macro in the AfterUpdate property of the control on the form where you
"select a video title".

This assumes a few things. One is that Video Rented is a Yes/No data
type. Another is that it is represented on the form. If this doesn't
work, you will need to let us know a lot more detail about the form, its
recordsource, and the table structure.

Steve Schapel, Microsoft Access MVP
 

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