Where do I put the code to check if a date is between to dates?

E

Erin Freeman

Hi there,

Here is the scenario.

We have a large database that is going to be split with up to 8 users.
This database consists of over 2000 nurses.
I need to have a piece of code that is always refreshing to check if the
nurse is on assignment. There is an assignment start date and an assignment
end date. so if todays date is between those two dates, the check box of "On
Assignment" automatically checks off. I am not sure where to put the code, do
i put it when the database opens? I supposed this code just needs to run the
first time it opens every morning... Any help would be appreciated....on the
code as well

Thanks in advance
 
D

Douglas J. Steele

Realistically, On Assignment shouldn't be stored in the table. Instead, it
should be a computed field in a query:

OnAssignment: [Assignment Start Date] < Date() And [Assignment End Date] >
Date()

or

OnAssignment: Date() Between [Assignment Start Date] And [Assignment End
Date]
 
E

Erin Freeman

thank you so much!

Douglas J. Steele said:
Realistically, On Assignment shouldn't be stored in the table. Instead, it
should be a computed field in a query:

OnAssignment: [Assignment Start Date] < Date() And [Assignment End Date] >
Date()

or

OnAssignment: Date() Between [Assignment Start Date] And [Assignment End
Date]

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Erin Freeman said:
Hi there,

Here is the scenario.

We have a large database that is going to be split with up to 8 users.
This database consists of over 2000 nurses.
I need to have a piece of code that is always refreshing to check if the
nurse is on assignment. There is an assignment start date and an
assignment
end date. so if todays date is between those two dates, the check box of
"On
Assignment" automatically checks off. I am not sure where to put the code,
do
i put it when the database opens? I supposed this code just needs to run
the
first time it opens every morning... Any help would be appreciated....on
the
code as well

Thanks in advance
 

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