Results 1 to 4 of 4
  1. #1
    Vishan is offline Novice
    Windows 7 32bit Access 2002
    Join Date
    Oct 2012
    Posts
    2

    If Condition Query in Access

    Hi All,

    I have some data as below and i want query as below.

    Mobile activationdate 1-Sep 2-Sep 3-Sep 4-Sep 5-Sep 6-Sep 7-Sep 8-Sep 9-Sep
    8826654878 9/1/2012 0 0 29.44 2.23 9.83 0 0 10.48 13.22
    9910134774 9/1/2012 0 0 0 9.72 6.18 8 11.46 1.4 3.7
    8826653406 9/1/2012 0 0 0 64.64 20 11.5 0 0 17
    8800988135 9/2/2012 0 0 0 0 0 0 0 0 5
    8527517271 9/2/2012 0 0 0 0 0 2.82 5.01 2.08 5.04
    9871746193 9/2/2012 0 0 0 0 0 3.05 20.97 69.86 0.39
    8800988030 9/3/2012 0 0 0 0 0 0 8.56 0 10.5

    if activation date = 9/1/12 then sum (4days) 1st to 4th. mean activation day + 4 Days.

    if there is any solution pls help.


    thnx
    Attached Files Attached Files

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,626
    The posted file is Excel spreadsheet. Was that an export from Access db?

    Do you intend to have a column for every day of the year? That is not a normalized data structure.

    What do you mean by 'mean activation day'?
    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.

  3. #3
    Vishan is offline Novice
    Windows 7 32bit Access 2002
    Join Date
    Oct 2012
    Posts
    2
    i mean, i have huge data with it's activation date in date format for the any 1 month, and i also have day on day figure of each activation date (about respectively 45 Days)

    i want query for (Activation Date + 4 Days),
    exp.
    If activation date=9/1/12 then sum from day1 to day4
    If activation date=9/2/12 then sum from day2 to day5
    If activation date=9/3/12 then sum from day3 to day6
    .
    .
    .
    .
    If activation date=9/30/12 then sum from day30 to day33

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,626
    As I said, data structure not normalized. I don't understand your reply, it doesn't actually address the question I posted.

    One way to do want you want with this data structure might be to create expressions in query that sum the fields in the groups of 4 you describe:

    Calc1: [Sep 1] + [Sep 2] + [Sep 3] + [Sep 4]
    Calc2: [Sep 2] + [Sep 3] + [Sep 4] + [Sep 5]
    Calc3: [Sep 3] + [Sep 4] + [Sep 5] + [Sep 6]
    etc

    Then make the query a GROUP BY (Totals) query that groups on the date field.

    Can include date criteria in each expression if you want:
    Calc1: IIf(ActivationDate=#9/1/2012#, [Sep 1] + [Sep 2] + [Sep 3] + [Sep 4], Null)
    Calc2: IIf(ActivationDate=#9/2/2012#, [Sep 2] + [Sep 3] + [Sep 4] + [Sep 5], Null)
    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.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Help with writing Query If Then Condition
    By taimysho0 in forum Queries
    Replies: 4
    Last Post: 01-20-2012, 06:09 PM
  2. Replies: 6
    Last Post: 12-01-2010, 06:52 PM
  3. Replies: 3
    Last Post: 11-19-2010, 01:48 PM
  4. Replies: 1
    Last Post: 03-04-2009, 10:13 PM
  5. Using a form to apply a condition to a Query
    By JeepWidow in forum Forms
    Replies: 0
    Last Post: 12-22-2008, 10:29 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