Updating a query via Excel macro

Coop

New Member
Joined
Aug 19, 2003
Messages
33
I have a macro which exports data from Excel to Access. While obtaining a value in Excel, can the criteria field on a query be changed to this value? Thank you.
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Is this query an MSQuery originating in Excel, or is it an Access query that you use to filter the data?

If it's Access, you can use variables if you turn the query into a SQL statement but we need to see what you have before giving any detailed help.

Go to the SQL view of the query, copy the code, and post it to the board

If it's Excel, consider using ADO code to push the data to Access. That way you can use cell values as your parameters to pull data from Access, or to filter data prior to exporting it.


Denis
 
Upvote 0
To answer your first question, it is an Access query.
Here is the SQL view of the query.

SELECT [Bank Data].BusinessDay, [Bank Data].Date, [Bank Data].IncDecBuyNeed
FROM [Bank Data]
WHERE ((([Bank Data].BusinessDay)=6))
ORDER BY [Bank Data].Date;


This is what I would like to do. I want to take the value in cell A1 on Sheet1 and change the parameter for the business day (which is at 6) to this value.
 
Upvote 0

Forum statistics

Threads
1,221,828
Messages
6,162,215
Members
451,752
Latest member
freddocp

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