Page 2 of 2 FirstFirst 12
Results 16 to 18 of 18
  1. #16
    natonstan is offline Advanced Beginner
    Windows 8 Access 2013
    Join Date
    Oct 2014
    Posts
    37
    Quote Originally Posted by andy49 View Post
    typed it too late
    Ok with AND at the end of the second to last line, I'm getting this error:

    Syntax error in query expression '(select top (1) t2.LastSalesRateChangeDate
    from tblForEx as t2
    where t2.BaseCur= t.BaseCur and t2.ForCur =t.ForCut
    t2.LastSalesRateChangDate < t.LastSalesRateChangeDate
    order by t2.LastSalesRateChangeDate desc


    )',

  2. #17
    natonstan is offline Advanced Beginner
    Windows 8 Access 2013
    Join Date
    Oct 2014
    Posts
    37
    I've managed to get the percentages to show using this code:

    SELECT t2.*, (SELECT top 1 t.ForExRate
    FROM tblForEx t
    where t.BaseCur=t2.BaseCur AND t.ForCur=t2.ForCur and t.LastSalesRateChangeDate<t2.LastSalesRateChangeDa te
    order by t.LastSalesRateChangeDate DESC, t.ForExRate DESC
    ) AS PreviousRate, [ForExRate]/[PreviousRate]-1 AS ChangeRatio
    FROM tblForEx AS t2;

  3. #18
    Micron is online now Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,799
    CROSS POSTED HERE
    https://www.mrexcel.com/forum/micros...wo-fields.html
    nanostan - please read why this is not cool http://www.excelguru.ca/content.php?184
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

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

Similar Threads

  1. Replies: 4
    Last Post: 06-27-2016, 03:09 PM
  2. Replies: 2
    Last Post: 02-11-2013, 01:26 PM
  3. Replies: 10
    Last Post: 10-19-2012, 05:10 AM
  4. Replies: 1
    Last Post: 10-09-2012, 09:08 AM
  5. Add fields and find percentage
    By gurp99 in forum Queries
    Replies: 1
    Last Post: 08-09-2010, 03:57 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