Update a value in the table upon clicking a button

K

karlreiner

Hi All,

I am fairly new to Access and is having a hard time achieving the things
below:

I have two Tables:

Daily Log
Volunteer List

1 form that logs user service times.

Upon clicking a button in the form I need the following to happen:

1) look in the "Daily Log" Table for [Volunteers] that have log a row with
[Date] within the last 6 months
Note: The Volunteer Column is only a look up, so the data in there is
actually equivalent to Volunteer_ID in the Volunteer List. Which means it is
simply numeric.
2) go to the "Volunteer List" Table and update the [Inactive/Active]
a. For those volunteers that are filtered in 1), return "active" in
[Inactive/Active]
b. For those that are not, return "inactive" in [Inactive/Active]
 
C

Crystal (strive4peace)

Hi Karl,

I will assume you have the following field in your table to
use as a flag:

- IsActive, yes/no (or Integer)

to set all the IsActive values to No False, 0), do this:

UPDATE MyTablename
SET IsActive = False;

to set the flag to True for date in the last 6 months:

UPDATE MyTablename
SET IsActive = True
WHERE Datefieldname between DDateAdd("m",-6,Date()) AND Date();

~~~

if you are storing the text "Active" or "Inactive", I would
recommend either a yes/no or integer field for this -- then
you can use a checkbox to display it and it takes less space
<smile>

For information on executing SQL statements in code, read
the SQL section of Access Basics in my siggy


Warm Regards,
Crystal
remote programming and training
http://MSAccessGurus.com

free video tutorials
http://www.YouTube.com/user/LearnAccessByCrystal

Access Basics
http://www.AccessMVP.com/strive4peace
free 100-page book that covers essentials in Access

*
:) have an awesome day :)
*
 

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