Passing a variable from Excel to fire an Access Query (1 Viewer)

daievans

Registered User.
Local time
Today, 13:49
Joined
Apr 3, 2013
Messages
75
I'm running a VBA routine in Excel that loops through a lot of data. As part of the process, I'd like to pass a variable from Excel to an Access database that is open and have it run a query based on that value ... anyone ever done it? Is it feasible?

It's not how I would do this project if it were not for the fat that it's a legacy system whose owners have a certain pride of authorship ;)

As usual, many thanks for your willingness to ponder my dilemma :banghead:
 

Galaxiom

Super Moderator
Staff member
Local time
Tomorrow, 06:49
Joined
Jan 20, 2009
Messages
12,863
What are you ding with the results of the query?

You can open a recordset directly from Excel without even having the database open.
 

daievans

Registered User.
Local time
Today, 13:49
Joined
Apr 3, 2013
Messages
75
What are you ding with the results of the query?

You can open a recordset directly from Excel without even having the database open.

Thanks for your response, G!

We're opening the Access database to verify (visually!) that the contents of a report are properly reflected in the Excel calculation. Ultimately, the goal will be to totally automate the process, but for now, they're wed to their status quo process.

So Essentially, I have excel on one screen and on the second screen I want to have access run a report that reflects the same client ID that we're processing in Excel.

Its very clunky, and alas nowhere near as sophisticated as what you were thinking! Hopefully, I can get the end-users to that point sooner rather than later ;)
 

daievans

Registered User.
Local time
Today, 13:49
Joined
Apr 3, 2013
Messages
75
Here's another attempt at describing my challenge - I have an Excel Model that is running a looping calculation. As it loops through the dataset, I'd like to be able topass a value its currently processing into an Access query (The Database is loaded and open) as a criteria value and then execute that query ....

Does anyone have any ideas on the best course of action? Can I use DoCmd.OpenQuery?
 

Galaxiom

Super Moderator
Staff member
Local time
Tomorrow, 06:49
Joined
Jan 20, 2009
Messages
12,863
Build a datasheet form based on the query.
Use DoCmd.OpenForm and pass the criteria as the WhereClause argument.
 

Users who are viewing this thread

Top Bottom