Results 1 to 7 of 7
  1. #1
    eyperry is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Jun 2016
    Posts
    3

    Design view to show the previous day phases and the next day phase

    Hello,



    I am working on a query. I have database the consist of the Moon phases and the day of the week of the phases of the moon and the date of the moon.
    For instance, 10/02/2020 Fri 1 (1 means it was a full moon)

    In my design view I have a criteria that says Enter moon phases I enter 0.97 then it runs and I am able to see all the phases of the moon with 0.97 phases and the day of the week it fell on and the date.

    How do I show in access design view the previous date and the next day phases. I want to see the phases of the moon one day before 0.97 and one day after 0.97.

    Please assist me

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,822
    You mean you want to 'see all the records of the moon with 0.97 phases' ?

    To accomplish retrieving day before and day after would have to first retrieve date of the 0.97 record then calculate a date range criteria. I think will involve nested subquery or DLookup() domain aggregate function. Something like:

    SELECT Phases.ID, Phases.PhaseDate, Phases.Phase
    FROM Phases
    WHERE (((Phases.PhaseDate) Between DLookUp("PhaseDate","Phases","Phase=" & [enter phase])-1 And DLookUp("PhaseDate","Phases","Phase=" & [enter phase])+1));

    Unless each day's phase always increments by 0.01. Then the range could be built from the phase parameter and applied to Phase field.

    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
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    some data and field/table names (or the query sql) might help to better focus an answer, but off the cuff I'd say use criteria where Max(of the field with .97) < [the value you supply] AND Min(that same field) > [the value you supply].

    EDIT - I took a different interpretation. June7 might be correct. Showing desired output would certainly help
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  4. #4
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,398
    perhaps some example data would help. I'm assuming it looks like

    phaseDate....phase
    31/12/2019......1
    1/1/2020......0.97
    2/1/2020......0.94
    ....
    ....
    29/1/2020.....1
    30/1/2020......0.97
    31/1/2020......0.94
    etc

    So the first question is are the dates contiguous? i.e. no gaps in dates?

    If they are contiguous, you can simply look up the day before and the day after (date-1 and date+1)

    second question is - how do you want the data displayed?

    phaseDate....phase...phaseBefore...phaseAfter
    1/1/2020.......0.97.........1..............0.94
    30/1/2020.....0.97.........1..............0.94

    or

    phaseDate.....phase
    31/12/2019......1
    1/1/2020......0.97
    2/1/2020......0.94
    29/1/2020.....1
    30/1/2020......0.97
    31/1/2020......0.94

    each have different solutions

  5. #5
    eyperry is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Jun 2016
    Posts
    3
    Ajax it looks like this


    So the first question is are the dates contiguous? i.e. no gaps in dates?


    If they are contiguous, you can simply look up the day before and the day after (date-1 and date+1)

    second question is - how do you want the data displayed?

    phaseDate....phase...phaseBefore...phaseAfter
    1/1/2020.......0.97.........1..............0.94
    30/1/2020.....0.97.........1..............0.94

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,822
    Have you tried query suggested in post 2?
    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.

  7. #7
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,398
    Ajax it looks like this
    all you have done is restate my question, not answered them

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

Similar Threads

  1. Replies: 1
    Last Post: 12-14-2018, 01:39 PM
  2. Replies: 1
    Last Post: 01-24-2017, 09:50 AM
  3. Replies: 6
    Last Post: 03-08-2014, 12:47 PM
  4. Replies: 2
    Last Post: 12-17-2013, 04:16 PM
  5. design phase ... question on multiple entries from same table
    By sbrockett751 in forum Database Design
    Replies: 2
    Last Post: 03-13-2013, 03:13 PM

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