So here's what I'm looking to accomplish, I basically need a table full of dates along with other bits of information but more so than that I need a way for the table to update itself automatically without a user having to manually input dates and that's where I thought VBA would be needed.
Here's the table structure that I've already laid out:
Cal_Date (Calendar Date, Date/Time)
DotW (Day of the Week, Text)
Cal_Mo (Calendar Month, Text)
Cal_Yr (Calendar Year, Number)
BCST_Mo (Broadcast Month, Text)
BCST_Yr (Broadcast Year, Number)
Week_Num (Week Number, Number)
I would like the table to be filled with 4 years of dates (2 years in the past, 2 years in the future) and I figure that the best way to accomplish that would be to use some sort of date function in VBA/SQL like "Date(Now())" and then just use something like "+/- 730" to get the date range that I need. And I would assume that there's something in VBA/SQL that I could use to get the Day of the Week, Calendar Month, Calendar Year, and Week Number to be included with the date in a query I just haven't found all of the pieces yet that I'm looking for. So if that part is simple and you want to throw that in with the main issue that I'm having then that would be awesome.
But the main problem that I have is trying to determine the Broadcast Month and Broadcast Year for a specific date. Here's an example of what I'm talking about:
Cal_Date.......DotW....Cal_Mo.......Cal_Yr...BCST_Mo...BCST_Yr..Week_Num
12/29/2014...Mon......December...2014.....January.....2015........1
As you can see with the 12/29 date provided the calendar month and year is December 2014 but the broadcast month and year is January 2015 because it falls in the first week of the new year.
Now what I'm trying to do is figure out how to put all of this information into a table that we can reference for reporting and whatnot.
Any suggestions?
A few things to explain in order to help clear things up and answer any questions:
1. Broadcast Weeks always go from Monday-Sunday
2. The 1st of the month will always have the same broadcast month/year as the calendar month/year (the same applies with the first half or so of the month)
3. The main issue is with the last few days of the month when they fall in the same week as the 1st of the following month.
Travis
Charter Media
Here's the table structure that I've already laid out:
Cal_Date (Calendar Date, Date/Time)
DotW (Day of the Week, Text)
Cal_Mo (Calendar Month, Text)
Cal_Yr (Calendar Year, Number)
BCST_Mo (Broadcast Month, Text)
BCST_Yr (Broadcast Year, Number)
Week_Num (Week Number, Number)
I would like the table to be filled with 4 years of dates (2 years in the past, 2 years in the future) and I figure that the best way to accomplish that would be to use some sort of date function in VBA/SQL like "Date(Now())" and then just use something like "+/- 730" to get the date range that I need. And I would assume that there's something in VBA/SQL that I could use to get the Day of the Week, Calendar Month, Calendar Year, and Week Number to be included with the date in a query I just haven't found all of the pieces yet that I'm looking for. So if that part is simple and you want to throw that in with the main issue that I'm having then that would be awesome.
But the main problem that I have is trying to determine the Broadcast Month and Broadcast Year for a specific date. Here's an example of what I'm talking about:
Cal_Date.......DotW....Cal_Mo.......Cal_Yr...BCST_Mo...BCST_Yr..Week_Num
12/29/2014...Mon......December...2014.....January.....2015........1
As you can see with the 12/29 date provided the calendar month and year is December 2014 but the broadcast month and year is January 2015 because it falls in the first week of the new year.
Now what I'm trying to do is figure out how to put all of this information into a table that we can reference for reporting and whatnot.
Any suggestions?
A few things to explain in order to help clear things up and answer any questions:
1. Broadcast Weeks always go from Monday-Sunday
2. The 1st of the month will always have the same broadcast month/year as the calendar month/year (the same applies with the first half or so of the month)
3. The main issue is with the last few days of the month when they fall in the same week as the 1st of the following month.
Travis
Charter Media