Week Days

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

Guest

I have 7 CheckBoxes for days of week:
1. SUN
2. MON
3. TUE...

I want to see data only for checked day.
All combinations of checked days in week can be possible.

Example:
If is checked SUN, MON and FRI I want to see data separately for each day
when is Sunday, Monday or Friday.
Thanks!
 
I have 7 columns (SUN, MON, TUE...) with yes/no datatype.
How to compare this with system date (WeekDay)?

In this table was stored daily jobs for my company, and want to display this
daily. Some jobs I must to do a few time in week, some just once.
 
Post the rest of your table structure. You must have more as you can not
compare a Yes/No to the SystemDate as there are approximately 52 Sundays in
every year. How would you know which one had the check mark?
 
Complete table structure:
ID (AutoNumber, primary key)
Plant (text)
Analysis (text)
SUN (yes/no)
MON (yes/no)
TUE (yes/no)
WED (yes/no)
THU (yes/no)
FRI (yes/no)
SAT (yes/no)
Employer (text)

Every week I have same jobs on specific days.
If is in system date monday I want to display all ID's with check on MON.
 
This can be done with this structure, but it is messy

SELECT *
FROM YourTable
WHERE (Weekday(Date())=1 And SUN= True)
OR (Weekday(Date())=2 And MON= True)
OR (Weekday(Date())=3 And TUE= True)
OR (Weekday(Date())=4 And WED= True)
OR (Weekday(Date())=5 And THU= True)
OR (Weekday(Date())=6 And FRI= True)
OR (Weekday(Date())=7 And SAT= True)

With a two table structure this would be simpler. Just drop the weekday
fields completely from the current table. The Second table would contain
two fields. A field that refers to the ID in the first table and a field
that contains a number from 1 to 7 to indicate the day of the week. You
would add one record to this table for each combination of active day and
first table id.

Then the search would be
SELECT YourTable.*
FROM YourTable INNER JOIN NewTable
ON YourTable.ID = NewTable.IdFirstTable
WHERE NewTable.DayNumber = Weekday(Date())
 
Back
Top