G
GB
This is the idea I want to try to implement in an access database.
I have an event that has a start and end date. Obviously the end date can
not be before the start date, however the end date could be the same as the
start date or the end date may be any amount of time following the start date.
For each event, I want to store the day(s) of the week that the event
occurs. I will be using a form to make the selection of the days available,
and I believe I will be able to control that input. However, I want to store
the corresponding value for the selection(s) made. I am thinking that if I
use an integer, and assign a value of 2 raised to the power of the day of the
week, that I can then decode the stored value to get each day. A table I
have established is like this:
[Day] [Value]
Monday 64
Tuesday 32
Wed. 16
Thurs 8
Fri 4
Sat 2
Sun 1
So if an event occurs on Mon, wed, and fri then I wish to store 84 (64+16+4)
for that event.
So now I have stored the day(s) of the week the event is on.
I want to then do a query for a given week. I have been able to setup the
basic part of the query, that if the start/end dates are within the week then
the event appears in the returned query. But I have not been able to design
a query that will use that information in conjunction with the stored integer
number so that I could test and say, okay if the event does occur at some
point during the week 1) display which day(s) of the week, 2) perform a query
for which events will be done on a given day, 3) display the event only if it
actually is happening (i.e. if the end date is Tuesday, and the class is only
held Friday, then don't display the class.)
I have written a simple VBA module that can return the power of 2 that is
included in the originally stored number, but I haven't been able to make any
good use of the information. (Obvious Access programming/usage deficiency.)
Hopefully I have explained what I am trying to do, if nothing else, I'm
trying to make data entry easy for the database user, and provide quality
results while minimizing actual database management.
Obviously when using a form to input data, I can test the days of the week
for the start and end date, and only provide those days in the drop down
list. Then when I go to store the data, I can convert it to an integer using
the table that has the values stored. I think that I'm using Access wrongly
for this, and if so, help a guy out if you could.
I have an event that has a start and end date. Obviously the end date can
not be before the start date, however the end date could be the same as the
start date or the end date may be any amount of time following the start date.
For each event, I want to store the day(s) of the week that the event
occurs. I will be using a form to make the selection of the days available,
and I believe I will be able to control that input. However, I want to store
the corresponding value for the selection(s) made. I am thinking that if I
use an integer, and assign a value of 2 raised to the power of the day of the
week, that I can then decode the stored value to get each day. A table I
have established is like this:
[Day] [Value]
Monday 64
Tuesday 32
Wed. 16
Thurs 8
Fri 4
Sat 2
Sun 1
So if an event occurs on Mon, wed, and fri then I wish to store 84 (64+16+4)
for that event.
So now I have stored the day(s) of the week the event is on.
I want to then do a query for a given week. I have been able to setup the
basic part of the query, that if the start/end dates are within the week then
the event appears in the returned query. But I have not been able to design
a query that will use that information in conjunction with the stored integer
number so that I could test and say, okay if the event does occur at some
point during the week 1) display which day(s) of the week, 2) perform a query
for which events will be done on a given day, 3) display the event only if it
actually is happening (i.e. if the end date is Tuesday, and the class is only
held Friday, then don't display the class.)
I have written a simple VBA module that can return the power of 2 that is
included in the originally stored number, but I haven't been able to make any
good use of the information. (Obvious Access programming/usage deficiency.)
Hopefully I have explained what I am trying to do, if nothing else, I'm
trying to make data entry easy for the database user, and provide quality
results while minimizing actual database management.
Obviously when using a form to input data, I can test the days of the week
for the start and end date, and only provide those days in the drop down
list. Then when I go to store the data, I can convert it to an integer using
the table that has the values stored. I think that I'm using Access wrongly
for this, and if so, help a guy out if you could.