[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[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!

8.4

How to get access UDF query into an Excel vba routine when Access is not installed on computer?

Asked by rberke in Microsoft Access Database, Microsoft Excel Spreadsheet Software

Tags: excel, vba, udf, query, access

How to get access UDF query into an Excel vba routine when Access is not installed on computer?

This is NOT easy.

I asked a similar question (Q_21335193) 2 years ago, and the solution was ART2KMIN. But today's question cannot be satisfied with ART2KMIN.

I also asked a similar question 2 months ago, and the solution was CreateObject("Access.Application").  But todays question cannot be satisfied with that.

And I have seen many similar questions that describe using DAO to get data from Access. But today’s solution cannot be satisfied with DAO.

The client's has sbs2003 is licensed for sql server, but it has never been implemented here.  Perhaps that is the solution?
-----------  here is the question ------------

I have an Access application that runs on 10 computers.  6 of the computers are using the Access Minumum Run Time environment, and 4 of them have Access 2003 installed.

I want Excel to grab data from an Access query which contains a UDF. Straight DAO does not allow this, it gives
'   Run time error 3085
'   Undefined function 'myFunction' in expression

In another try, I got an error 429 <ActiveX component can’t create object > when I tried using  createobject(“Access Application as suggested in http://www.experts-exchange.com/Software/Office_Productivity/Office_Suites/MS_Office/Excel/Q_22108929.html.


Does anybody have suggestions for a solution that will work on the 7 CPUs without purchasing Access at approximate cost of $150 each?  

Microsoft's solution is very complicated and expensive.  Folks can read about it here http://office.microsoft.com/en-us/access/HA011208861033.aspx.

The client's has sbs2003 is licensed for sql server, but it has never been implemented here.  Perhaps that is a solution?

If anybody feels like experimenting with this problem, the following code can be put into Access and Excel to demonstrate the problem.

----------------- code and query definitions to put into an empty access database -----------
'myQueryUDF:
'  SELECT "udf" AS Expr1, always5(0) AS Expr2, * FROM MSysAccessObjects;
'
'myQuery:
'  SELECT "noudf" AS Expr1, * FROM MSysAccessObjects;
'
' Function always5(x)
'    always5 = 5
' end function
'

----------------- code to put into an empty Excel workbook  -----------

Sub testDao()
' step 1 works on all windows computers, but step2 cannot get queries with UDF
'
Set Db = DAO.OpenDatabase("e:\aaatmp\deletenow.mdb")
Set rs = Db.OpenRecordset("SELECT * from myquery")
step1:
[a1].CopyFromRecordset rs
' the following line gives
'   Run time error 3085
'   Undefined function 'myFunction' in expression

step2:
Set rs = Db.OpenRecordset("SELECT * from myqueryUDF")
[a20].CopyFromRecordset rs
Set rs = Nothing
Set Db = Nothing


End Sub


Sub testCreateObject()
' step 3 can access the UDF, but only if Access is installed on the computers
    Set AccApp = CreateObject("Access.Application")
    AccApp.OpenCurrentDatabase ("e:\aaatmp\deletenow.mdb")
    Set Db = AccApp.CurrentDb
    Set rs = Db.OpenRecordset("myQueryUdf")
step3:    
    [a1].CopyFromRecordset rs
   
    rs.Close
    Set rs = Nothing
    Set Db = Nothing
    With AccApp
        .CloseCurrentDatabase
        .Quit
    End With
   
    Set AccApp = Nothing

End Sub
[+][-]03/14/07 04:57 AM, ID: 18717543Accepted Solution

View this solution now by starting your 30-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

Zones: Microsoft Access Database, Microsoft Excel Spreadsheet Software
Tags: excel, vba, udf, query, access
Sign Up Now!
Solution Provided By: rorya
Participating Experts: 2
Solution Grade: A
 
[+][-]03/14/07 01:43 AM, ID: 18716893Expert Comment

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 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03/14/07 09:27 AM, ID: 18719795Author Comment

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 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03/15/07 03:04 AM, ID: 18725721Expert Comment

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 30-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091118-EE-VQP-93