Results 1 to 5 of 5
  1. #1
    TheSpecialist is offline Advanced Beginner
    Windows 8 Access 2010 64bit
    Join Date
    Jul 2015
    Location
    Georgia
    Posts
    47

    Help SQL please

    Hello,

    I want a paramater box so when I open the my database I will be prompt to enter a moon phase number. Like 1 or .98, .99 etc
    I keep getting a error with my sql script. I just want to be able to put in 1 or .98 and all the table I have below show me the 1 day before and 1 day after how I have below please assist me.

    PARAMETERS [Enter YourNumber:] Number;
    SELECT "MoonPhaseTable" AS SourceTable, YourDate, YourNumber
    FROM MoonPhaseTable
    WHERE YourDate BETWEEN [Enter Date:]-1 AND [Enter Date:]+1
    UNION ALL
    SELECT "Cash4Table", YourDate, YourNumber
    FROM Cash4Table
    WHERE YourDate BETWEEN [Enter Date:]-1 AND [Enter Date:]+1
    UNION ALL


    SELECT "GAFiveTable", YourDate, YourNumber
    FROM GAFiveTable
    WHERE YourDate BETWEEN [Enter Date:]-1 AND [Enter Date:]+1
    UNION ALL SELECT "YourTable", YourDate, YourNumber
    FROM YourTable
    WHERE YourDate BETWEEN [Enter Date:]-4 AND [Enter Date:]+1
    ORDER BY SourceTable, YourDate;

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    you don't do date math that way,
    you use DateAdd ,or DateDiff

    DateAdd("d",-1,[Enter Date]) and DateAdd("d",1,[Enter Date])

  3. #3
    TheSpecialist is offline Advanced Beginner
    Windows 8 Access 2010 64bit
    Join Date
    Jul 2015
    Location
    Georgia
    Posts
    47
    Hi I want it to operate like this below. I just want to use MoonPhase Number. The table below works I just want to use Moonphase Number when the box pops open

    PARAMETERS [Enter Date:] DateTime;
    SELECT "YourTable" AS SourceTable, YourDate, YourNumber
    FROM YourTable
    WHERE YourDate BETWEEN [Enter Date:]-1 AND [Enter Date:]+1
    UNION ALL
    SELECT "Cash4Table", YourDate, YourNumber
    FROM Cash4Table
    WHERE YourDate BETWEEN [Enter Date:]-1 AND [Enter Date:]+1
    UNION ALL
    SELECT "GAFiveTable", YourDate, YourNumber
    FROM GAFiveTable
    WHERE YourDate BETWEEN [Enter Date:]-1 AND [Enter Date:]+1
    UNION ALL SELECT "MoonPhaseTable", YourDate, YourNumber
    FROM MoonPhaseTable
    WHERE YourDate BETWEEN [Enter Date:]-4 AND [Enter Date:]+1
    ORDER BY SourceTable, YourDate;

  4. #4
    Perceptus's Avatar
    Perceptus is offline Expert
    Windows 7 64bit Access 2007
    Join Date
    Nov 2012
    Location
    Knoxville, Tennessee
    Posts
    659
    You should follow ranmans suggestion

  5. #5
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    "...then God replied, 'I sent 3 boats.' "

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

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