By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,327 Members | 1,789 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,327 IT Pros & Developers. It's quick & easy.

update fields in table using vba

P: n/a
i have a client who's database requires users to enter the beginning
date and ending date for contracts. i would like to create a vba
function that checks the end date w/ the now() function (from what i've
gathered) and updates the status field with "Expired" if the end date
has passed. can i have this function run when the form opens, or a
report is run, so it loops through the entire table and adjusts these
fields as necessary? how should i code it?

any help with this would be greatly appreciated.

thanks,

dan

May 10 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
<Da********@gmail.com> wrote
i have a client who's database requires users to enter the beginning
date and ending date for contracts. i would like to create a vba
function that checks the end date w/ the now() function (from what i've
gathered) and updates the status field with "Expired" if the end date
has passed. can i have this function run when the form opens, or a
report is run, so it loops through the entire table and adjusts these
fields as necessary? how should i code it?


You can, easily, create an update query to do what you describe. You'll have
to run it either manually or programmatically -- it could be done in code in
the form from which you open the form or report, or, perhaps, in the Form or
Report's Open event.

Because the Now function includes both Date and Time, you might want to use
the Date function that uses midnight of the date for the time.

Larry Linson
Microsoft Access MVP
May 10 '06 #2

P: n/a
Thanks Larry, that is brilliant!

Dan

May 10 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.