The 'rownum' syntax is just for Oracle. Just quickly glancing at the query what it looks like it is trying to do is get the latest value for something out of HRHISTORY. You may try replacing that subquery with this on as it may work. You will need to test it. If you can get away with it it may be better to leave this data on the main database and query it there. Having seperate access databases can be problematic. Most IT organizations really do not enjoy running across access databases. They tend to get corrupted and all sorts of other issues. Another thing that I find business users can really get value out of is having a query like this created as a view.
(
SELECT hrh.A_VALUE
FROM HRHISTORY hrh
WHERE PEM.COMPANY = hrh.COMPANY
AND PEM.EMPLOYEE = hrh.EMPLOYEE
AND hrh.FLD_NBR = 14
AND hrh.BEG_DATE =
SELECT MAX(hrh2.BEG_DATE)
FROM HRHISTORY hrh2
WHERE hrh.COMPANY = hrh2.COMPANY
AND hrh.EMPLOYEE = hrh2.EMPLOYEE
AND hrh.FLD_NBR = hrh2.FLD_NBR
)
AND hrh.SEQ_NBR =
SELECT MAX(hrh3.SEQ_NBR)
FROM HRHISTORY hrh3
WHERE hrh.COMPANY = hrh3.COMPANY
AND hrh.EMPLOYEE = hrh3.EMPLOYEE
AND hrh.FLD_NBR = hrh3.FLD_NBR
AND hrh.BEG_DATE = hrh3.BEG_DATE
) AS process_level_id