ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Using external query (mdb) for dynamic date range (https://www.excelbanter.com/excel-worksheet-functions/263223-using-external-query-mdb-dynamic-date-range.html)

Burnnie Holliday

Using external query (mdb) for dynamic date range
 
I'm trying to set up an Excel workbook with a dynamic link to an Access
database containing quality data, involving dates. I want the workbook to
always import data for the last 90 days. When I try to set this up using MS
Query, to try to filter data I've tried several different variations where
time is greater than or equal to:

date()-30
today()-30
now()-30

And every time, it comes back as an error. It seems to be setting the query
so that the entire statement is a date variable, eg "Syntax error in query
expression '((Table1.Time=#date()-30#))'" where I'm pretty sure that the
query should read "((Table1.Time=date()-30))", but I can't find a way to
edit the query directly. It insists on using the Query Wizard instead.

--
Burnnie Holliday
Data Wrangler

Burnnie Holliday

Using external query (mdb) for dynamic date range
 
Heh... make that the last 30 days. You get the point.
--
Burnnie Holliday
Data Wrangler


"Burnnie Holliday" wrote:

I'm trying to set up an Excel workbook with a dynamic link to an Access
database containing quality data, involving dates. I want the workbook to
always import data for the last 90 days. When I try to set this up using MS
Query, to try to filter data I've tried several different variations where
time is greater than or equal to:

date()-30
today()-30
now()-30

And every time, it comes back as an error. It seems to be setting the query
so that the entire statement is a date variable, eg "Syntax error in query
expression '((Table1.Time=#date()-30#))'" where I'm pretty sure that the
query should read "((Table1.Time=date()-30))", but I can't find a way to
edit the query directly. It insists on using the Query Wizard instead.

--
Burnnie Holliday
Data Wrangler


Burnnie Holliday

Using external query (mdb) for dynamic date range
 
Nevermind, I've just figured out the answer.
--
Burnnie Holliday
Data Wrangler


"Burnnie Holliday" wrote:

I'm trying to set up an Excel workbook with a dynamic link to an Access
database containing quality data, involving dates. I want the workbook to
always import data for the last 90 days. When I try to set this up using MS
Query, to try to filter data I've tried several different variations where
time is greater than or equal to:

date()-30
today()-30
now()-30

And every time, it comes back as an error. It seems to be setting the query
so that the entire statement is a date variable, eg "Syntax error in query
expression '((Table1.Time=#date()-30#))'" where I'm pretty sure that the
query should read "((Table1.Time=date()-30))", but I can't find a way to
edit the query directly. It insists on using the Query Wizard instead.

--
Burnnie Holliday
Data Wrangler



All times are GMT +1. The time now is 01:48 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com