Advertisement

05.10.2008 at 11:00AM PDT, ID: 23391882
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.2

Help ADO -- import access query into excel via vba

Asked by newyears98 in Microsoft Excel Spreadsheet Software

Tags: , ,

Here is what I'm trying to accomplish with ADO connections:

In excel, user clicks button:

1) open access database "DPS.mdb
2) run macro name "DPSfile" in access
3) query named "DPS#3: is populated with information
4) copy dps#3 into excel sheet named "actual"
5) close access

This is what I started with not using ADO, and it worked once. Now when I run it again, the query is being pulled from another location from c:\mydocuments. I thought it be better to use ADO versus the query refresh method.

Private Sub obtaincmmsdata_Click()
Dim obtaincmmsdata As String
Dim AC As Object
Set AC = CreateObject("access.application")
AC.Visible = False

AC.opencurrentdatabase (w:\DPS.mdb)
With AC
.DoCmd.RunMacro "DPSfile"
.Quit
End With
Sheets("Actual").Select
Range("E2").Select
Selection.QueryTable.Refresh BackgroundQuery:=False

End Sub

The DPSfile is a database that opens several tables and run multiple queries to get the final data in the correct orientation that I need. The final result of the macro in access is query named DPS#3. The sql view of DPS#3 is

TRANSFORM Sum([BTS TEST].PROD) AS SumOfPROD
SELECT [Department Table].CD_AREA AS Area, "Actual" AS Product, [Department Table].DS_WORK_CNTR AS DepartmentName, [Department Table].NO_WORK_CNTR AS WorkCenter
FROM [Department Table] LEFT JOIN [BTS TEST] ON [Department Table].NO_WORK_CNTR=[BTS TEST].NO_WORK_CNTR
WHERE ((([Department Table].NO_WORK_CNTR)="0" Or ([Department Table].NO_WORK_CNTR)="6637F" Or ([Department Table].NO_WORK_CNTR)="6637A" Or ([Department Table].NO_WORK_CNTR)="6669A" Or ([Department Table].NO_WORK_CNTR)="66683" Or ([Department Table].NO_WORK_CNTR)="66682" Or ([Department Table].NO_WORK_CNTR)="6634F" Or ([Department Table].NO_WORK_CNTR)="6634A" Or ([Department Table].NO_WORK_CNTR)="6631A" Or ([Department Table].NO_WORK_CNTR)="66697" Or ([Department Table].NO_WORK_CNTR)="6627F" Or ([Department Table].NO_WORK_CNTR)="6627A" Or ([Department Table].NO_WORK_CNTR)="6633F" Or ([Department Table].NO_WORK_CNTR)="6633A" Or ([Department Table].NO_WORK_CNTR)="6631F" Or ([Department Table].NO_WORK_CNTR)="6632F" Or ([Department Table].NO_WORK_CNTR)="6632A" Or ([Department Table].NO_WORK_CNTR)="6627E" Or ([Department Table].NO_WORK_CNTR)="6627B" Or ([Department Table].NO_WORK_CNTR)="66689" Or ([Department Table].NO_WORK_CNTR)="66688" Or ([Department Table].NO_WORK_CNTR)="66687" Or ([Department Table].NO_WORK_CNTR)="66681" Or ([Department Table].NO_WORK_CNTR)="66676"))
GROUP BY [Department Table].CD_AREA, "Actual", [Department Table].DS_WORK_CNTR, [Department Table].NO_WORK_CNTR
PIVOT [BTS TEST].[DAY OF THE WEEK];

I was thinking of adding ADO after I run the macro in my above code, and then copy this query into excel, and then close access and the connection.

I appreciate any help you could provide. I'm not familiar with the ADO commands, but I'm willing to learnStart Free Trial
[+][-]05.10.2008 at 11:12AM PDT, ID: 21540029

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.10.2008 at 11:21AM PDT, ID: 21540054

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.10.2008 at 11:33AM PDT, ID: 21540094

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Microsoft Excel Spreadsheet Software
Tags: microsoft, office, excel
Sign Up Now!
Solution Provided By: zorvek
Participating Experts: 1
Solution Grade: A
 
 
[+][-]05.10.2008 at 02:14PM PDT, ID: 21540493

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.10.2008 at 02:16PM PDT, ID: 21540503

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.02.2008 at 12:57AM PDT, ID: 22143466

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]08.06.2008 at 03:34PM PDT, ID: 22175871

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20081112-EE-VQP-42 / EE_QW_2_20070628