Results 1 to 4 of 4
  1. #1
    JRCharlie's Avatar
    JRCharlie is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2011
    Posts
    20

    Sbquery error

    Hi


    I have a Reading table with some water readings. the Table consistes of ID, customer=text,Reading_Date=Datetime Picker,Reading=Number.
    Also have a Reading_Summury query that selects data from the Customer Table which Displays Information pulled From The reading table Which Works fine The User will have to inter the month and year to be displayed.
    Now I would like to add the reading for the previous month (1 month previous the month the user entered. Every attempt I try I get asyntax error.
    This is my last atempt.
    Code:
    SELECT Reading_tbl.Reading_Date AS RD, PLAZA.plzName AS Plaz, Customer.[Meter#] AS [Account Code], Customer.cusName AS Account, Customer.UNIT, Customer.CustShort, Customer.[Meter#], Customer.Meter_Size, Reading_tbl.Reading AS [Current], MAX.MaxOfReading AS [MAX], Min.MinOfReading AS [MIN], DateAdd("m",-1,[rd]) AS LMonth, (Select
        [Reading_qry].Reading
      From
        [Reading_qry]
      Where
        [Reading_qry]].[date_Read] = DateAdd("m", -1, [Reading_tbl]].[Reading_Date])
        And
        [Reading_qry].Account = [Reading_tbl].Customer)
    FROM ((((PLAZA LEFT JOIN Customer ON PLAZA.plzID = Customer.CustPlaza) LEFT JOIN Reading_tbl ON Customer.cusName = Reading_tbl.Customer) LEFT JOIN [MAX] ON Customer.custID = MAX.custID) LEFT JOIN [Min] ON Customer.custID = Min.custID) LEFT JOIN Reading_qry ON Customer.cusName = Reading_qry.Account
    WHERE (((Format([Reading_Date],"m/yy"))=[Month/Year]));

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870

  3. #3
    NTC is offline VIP
    Windows 10 Access 2013
    Join Date
    Nov 2009
    Posts
    2,392
    Where is it that the user enters the Month and Year?

  4. #4
    JRCharlie's Avatar
    JRCharlie is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2011
    Posts
    20
    Thanks For your link Orage it Was very HelpFull.
    The user Enter The mnth/year in a Parameter.

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

Similar Threads

  1. Replies: 1
    Last Post: 09-22-2016, 05:05 AM
  2. Replies: 6
    Last Post: 03-17-2016, 02:10 PM
  3. Replies: 3
    Last Post: 01-23-2014, 07:49 AM
  4. Replies: 0
    Last Post: 07-16-2012, 05:42 AM
  5. Replies: 6
    Last Post: 05-30-2012, 12:32 PM

Tags for this Thread

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