When the day comes

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a database with licenses. I want to add some Access tricks so I know a
license has to be renewed. In the database I got the date when a license
expire, but how can this date be compared to the date "today"? What is the
best response the Access can give, e.g. .a report or something else? I
understand that I can't use triggers in Access but is there some other
possibilities?

Best regards from Iceland

Chris
 
You can use a timer event on a form to check for these items. You may want
to open the form as a hidden form when you open your database so that no one
will close the form. To use the timer, you set the Timer Interval in the
form's Properties sheet (Events tab) then place code in the Timer event. The
Timer Interval is in milliseconds (i.e. 1000 = 1 second).
 
Assuming that the period of a licence is more than a few hours, i would have
thought that the timer interval was not the best to use.

I would use the Date() fuction which is access's functon for 'today'.

I would set up a check box called Expired on you form which contains the
licence info and set its control source to the following:

Iff([ExpiryDate] > "Date()", -1,0)

HTH

Rico
 
You need something to "trigger" the check for expired licenses. You can do
this each morning as you open your database by making the check in the Load
event of your initial form if one check per day is sufficient and if the
database will be closed and opened at least once per day. If the database
may be open all of the time, then you need something that will check on a
regular interval to see if there are any expired licenses. You could place
this check in any event that you want, just be aware that it won't do the
check unless you do what is necessary to trigger that event. The timer event
is a way around you having to trigger the event. I would probably place a
static variable in the timer event to have it remember the last date that it
did a check and if today isn't a new day, then Exit Sub. This would have it
run very quickly. I would probably also set it to a very long interval, at a
minimum 60000 (1 minute).

The checkbox you have will work fine. It won't require any event or
interaction, it will simply display checked or unchecked when you go to that
record. However, if you want a message to pop up saying that there are
expired licenses somewhere in the records, not just the record you're
looking at, then you will need to use an event as was mentioned above.
Instead of the checkbox, you could also use Conditional Formatting to change
the foreground and/or background color of the textbox that has the expiry
date.
 

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

Back
Top