问题
I'm using Microsoft Query in Excel to pull data from an Access database. I don't own the Access database, but I have permission to query its tables and queries using my Excel spreadsheet. I'm trying to pull data between tomorrow at 01:00:00 and the following morning at 00:00:00. I've tried everything from
WHERE (acct_data.Date Between DATEADD(DAY,1, DateADD(HOUR,1, GETDATE())) And DATEADD(DAY,2, GETDATE())))
to
WHERE (acct_data.Date Between DATEADD(DAY,1, DateADD(HOUR,1, GETDATE())) And DATEADD(DAY,2, GETDATE())))
and everything(except the correct code)in between. Does anyone know the correct syntax to get data from tomorrow at 1AM to midnight?
回答1:
It's solved.
WHERE ((([Acct_data]. [Date] Between Date() + 1.04166 And Date() + 2
It works now. I literally copied and pasted from a notepad file that I saved it in yesterday. I tried it one more time to see what error message that I was getting. Not sure why I received no error today. I think I was getting a "parameter expected" message. I must have had something wrong somewhere else in the process.
Thanks for your help everyone. Ryguy72, if you wouldn't have posted that link, I would have give up that route. I decided to give it another go.
来源:https://stackoverflow.com/questions/43011983/using-excel-ms-query-to-pull-data-from-access