I have created a SQL query (from SQL Server 2008) and connected the query into Excel (2010). I have populated a table and everything works fine. However, my query contains certain parameters that I wish to be changed by non SQL users in a shared excel workbook. My goal is to create a form (using ADO I assume) where the user of the workbook can enter the parameter information (In this case it will be item codes and date) and then have the SQL run and refresh back to the table in Excel. I am new to VBA and have no prior knowledge of it, however my SQL Code is:
select sis.store_key as[Store ID], i.item_code as[Item Code], i.name as[Item Name],
inv
.cases as[Inventory Quantity (Cs)], inv.commited_qty as[Committed Quantity (Units)],
inv
.last_receive_date as[Last Date Received], sis.sales_quantity_average_5wk as[5 Week Average Sales (Units)]
from item i
innerjoin
weekly_item_store_history wh
on
i
.item_key = wh.item_key
innerjoin inventory inv on
wh
.item_key = inv.item_key
and wh.store_key = inv.location_key
innerjoin snapshot_item_store sis on
sis
.item_key = wh.item_key
and sis.store_key = inv.location_key
and sis.store_key
in(
select store_key
from store s
where number in())

and i.item_key in(
select item_key
from item
where item_code in())
and fiscal_week_key =
orderby[Store ID],[Item Code],[Item Name],[Inventory Quantity (Cs)],
[
Committed Quantity (Units)],[Last Date Received],[5 Week Average Sales (Units)]