SQL code to extract rolling 12 Months data

S

Sarah (OGI)

I've created a query in Access which pulls out data on a rolling 12 basis
(showing data for the previous 12 months), using the following expression:

Between DateAdd("m",-13,Date()) And Date()

When I try to access this query via a Get External Data route from Excel
(against an MS Access Database), it seems to lose the expression.

I've tried to enter the expression again in the SQL code but it doesn't seem
to work (saying invalid use of '.', '!', '()'...). I've also tried to enter
a similar expression (see below) used in another document but it doesn't like
that either.

(MDY(month(today),1,year(today),1,year(today))-13 units month) and
(MDY(month(today),1,year(today))-2 units month)

Is there another way of writing this expression when capturing data from an
MS Access Database?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top