Page 2 of 2 FirstFirst 12
Results 16 to 18 of 18
  1. #16
    nick243 is offline Competent Performer
    Windows 7 64bit Access 2002
    Join Date
    May 2016
    Posts
    185
    Quote Originally Posted by June7 View Post
    Weekly grouping is more complicated. Do you want a week to be 7 days Sun-Sat regardless of month or year? In other words, what do you want to do about weeks that cross months and years? Also, months do not all have the same number of weeks. Can calculate the date of the first day of each week with DateAdd("d", Weekday(datefield)+1, datefield), and that ignores crossing month and year. However, that does not allow for dynamic quality in the CROSSTAB.

    Calculate a week identifier with DatePart("ww", [datefield]) to use as ColumnHeader. A year seems to have 53 weeks. I tested with DatePart("ww", #12/31/2107#) with a variety of years and always get 53.

    Also calculate year and month from the datefield to use as RowHeaders.

    Then instead of the 12 months in the CROSSTAB, use numbers 1 through 53.

    If 53 weeks does not fit your requirements will have to come up with some other algorithm to calculate weekly identifier.



    Might find of interest:
    https://www.accessforums.net/showthread.php?t=57472
    https://www.accessforums.net/showthread.php?t=17555
    https://www.accessforums.net/showthread.php?t=49247
    Yes Sunday thru Saturday works for me. If the cancel by date falls with in the 7 days I want it to be shown in there with how many units from a certain department. Yes, I have seen the correct amount of weeks to be 53, I cant remember the specific page but Microsoft has a help page with that query language. I just wasn't sure how to do the headings. So I need to create 53 column headings in query design view? Thank You for your help.

  2. #17
    nick243 is offline Competent Performer
    Windows 7 64bit Access 2002
    Join Date
    May 2016
    Posts
    185
    I found the function from microsoft
    Contain dates within the following week Year([SalesDate])* 53+DatePart("ww", [SalesDate]) = Year(Date())* 53+DatePart("ww", Date()) + 1 Returns items with dates during next week. A week in Access starts on Sunday and ends on Saturday.
    I think this would apply to my situation?

  3. #18
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,646
    If you want to pull next week's records. Change the +1 to whatever increment you want or remove it.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Network error and Command Button error
    By Sandra Williams in forum Access
    Replies: 1
    Last Post: 05-26-2013, 09:25 AM
  2. Replies: 7
    Last Post: 12-20-2012, 10:20 PM
  3. Importing objects error
    By Abacus1234 in forum Import/Export Data
    Replies: 8
    Last Post: 06-15-2012, 10:31 AM
  4. Network Error 3043
    By khalid in forum Programming
    Replies: 10
    Last Post: 05-15-2011, 02:49 AM
  5. Error message when mapping network drive
    By dwcolt in forum Programming
    Replies: 5
    Last Post: 05-11-2011, 08:56 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums