Get data for previous dates and a database oddity

RichardMGreen

Well-known Member
Joined
Feb 20, 2006
Messages
2,177
Hi all

I suppose this is two questions in one.
Firstly, I have a spreadsheet with a load of query names which are run via some code (I'll post if if anyone needs it). Most of the queries require an input which is supplied via cells on the spreadsheet and work OK. Two queries, however, don't need any inputs and are not returning any data to the spreadsheet even though they have records when run in the database.

Anyone any ideas on that one?


Secondly, within the database I need to be able to get data for a month 6 and 12 months ago from a supplied date.
E.g. If I supplied todays date, then I would want all data for January this year and July last year.
All the supplied dates are pre-built in the spreadheet (see above).
Anyone any ideas on this one?

I'm not sure if that is going to be clear enough, so feel free to ask for extra info (don't know what else anyone will need).

Any help would be greatly appreciated.
 
Last edited:
Thanks James.

I was treating the Access query as Access SQL which is different to proper SQL. I've made the change and it now works via Excel. The only problem is I can't now run the query in Access because of the change of wildcard.

::edit::
Solved that bit as well. Put the Access wildcard as an OR condition so it looks for both in both (if you see what I mean).
Now works in Access and returns the correct results to Excel.

Thanks for stating the obvious!! ;)
 
Last edited:
Upvote 0

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Solved that bit as well. Put the Access wildcard as an OR condition so it looks for both in both (if you see what I mean).
Now works in Access and returns the correct results to Excel.
ooh, that's a good solution
I actually 2 versions of every query DOH !

yeah, that adodb can be a real pain
I forget that * % thing every couple of months and sit there totally frustrated out of my mind

"I can SEE the row in the table ! I'm looking at it right now ! Why does this stupid query not work ? !"

15 fist pounding minutes later
"oh yeah, I forgot"
 
Upvote 0

Forum statistics

Threads
1,225,157
Messages
6,183,247
Members
453,152
Latest member
ChrisMd

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top