Run Access Query with VBA function in VB6?


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 6 of 6

Thread: Run Access Query with VBA function in VB6?

  1. #1
    Join Date
    Aug 2004
    Location
    Orange, California
    Posts
    1,263

    Run Access Query with VBA function in VB6?

    I have a query in my Access database that has a complex calculation for
    one of the calculated fields. I wrote the function in VBA code and it runs
    fine in Access; but my application is a VB6 appilcation. When I try to run
    the query either by the query name or by copying the SQL, I get an error
    that says it can't find my function. I moved a copy of the function into
    VB6 but the query still can't find the function. Any Ideas how to make this
    work?

  2. #2
    Join Date
    Dec 2003
    Posts
    2,750
    Custom VBA functions are not available through Jet OLEDB. Some standard VBA functions are available via sandbox mode:

    http://support.microsoft.com/kb/239482
    Paul
    ~~~~
    Microsoft MVP (Visual Basic)

  3. #3
    Join Date
    Aug 2004
    Location
    Orange, California
    Posts
    1,263
    Custom VBA functions are not available through Jet OLEDB
    Is there any way arround this?

  4. #4
    Join Date
    Dec 2003
    Posts
    2,750
    Not that I'm aware of. Unfortunately user-created custom functions are executed via Microsoft Access and not via Jet.

    The only comparable alternative would be SQL Server Express and stored procedures.
    Paul
    ~~~~
    Microsoft MVP (Visual Basic)

  5. #5
    Join Date
    Sep 2006
    Posts
    11
    Have you tried keeping the function in VBA and invoking it through the Application.Run method?

  6. #6
    Join Date
    Aug 2004
    Location
    Orange, California
    Posts
    1,263
    That would probably work, because you would have access running in the background.
    The only problem is that every machine running your VB6 program would also need
    Access installed on it, plus the requirement of having both Access and your VB6 app
    running.
    Unless?, is there a way to get VBA running in the background, without Access itself
    needing to be installed? If So, how would you programatically get VBA to know about
    ADO, and how would you get your functions, that is your custom code, into VBA?
    Also is VBA installed on all Windows based Systems? Can I legally install VBA if not?

Similar Threads

  1. call function for button
    By angela_quests in forum VB Classic
    Replies: 2
    Last Post: 04-13-2007, 05:57 AM
  2. Packed Data(Comp-3, etc)
    By Marcos in forum VB Classic
    Replies: 3
    Last Post: 01-25-2006, 12:18 PM
  3. How to run MS Access Query from ASP?
    By Hema in forum ASP.NET
    Replies: 2
    Last Post: 03-12-2002, 12:03 PM
  4. Vb6 and Access NZ function
    By Jim F in forum VB Classic
    Replies: 10
    Last Post: 07-26-2000, 01:16 PM
  5. I am helpless - Edit Info form
    By Dan in forum VB Classic
    Replies: 0
    Last Post: 03-17-2000, 06:14 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center