Link to home
Start Free TrialLog in
Avatar of newone2011
newone2011

asked on

Call database query from excel sheet

What would be the bext way to have  a query run from excel sheet.  I have added a button which needs to trigger the query.  I have added a query as part of the connection set up.
When I hit run on the button the query  resilts should show up on the worksheet.
Can someone list the steps on how to achieve this.
Avatar of nutsch
nutsch
Flag of United States of America image

Which excel version? You don't really need a button, you just need to set up the query (from the Data menu) and once set up, you can right-click the data and refresh.

Thomas
Avatar of newone2011
newone2011

ASKER

on 2007, yes I am seeing the data menu. However in my query the user need to be able put in the dates.  It will be between two dates ie start date and end date. How can this be done  ?
What are you querying? Access, SQL?
SQL
So my query will be like

" select a, b, c from Test where start_date>=?  and end_date <= ?
ASKER CERTIFIED SOLUTION
Avatar of nutsch
nutsch
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Actually I already created the query and added to the spreadsheet using microsfoft date query.  It works very well.  Can you tell me how I can use a button to just pick the start dates from rows b4 and b5
Do you want to change the query, or just do a filter on the data?
if you are using Microsoft query and want to have a parameter, just equate the fields to ?

ex.: column_param<=?
Good