Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Getting Office Automation to work within VB6

Posted on 2010-09-01
4
Medium Priority
?
435 Views
Last Modified: 2012-05-10
I have a VB application the uses data from a MSAccess DB.  I have this code that works correctly.

        Set acApp = CreateObject("Access.Application")
            With acApp
                .OpenCurrentDatabase "V:\FRED\UPS_VInfo\UPS_VInfoVB.mdb"
                .DoCmd.TransferText , "UPS_Import_Raw", "UPSImport", _
                        mPathImport & mFile1, False
                .CloseCurrentDatabase
                .Quit
            End With
        Set acApp = Nothing

When I change the DoCmd.OpenQuery "qryName" the code fails with something about Office Automation failing.  The "qryName" is a simple update query.  Is there anyway to get this sort of query to work from within VB?

Appreciate assistance.
Fred
0
Comment
Question by:Tylendal1
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 9

Expert Comment

by:javajws
ID: 33583361
Have you tried using
CurrentDb.Execute <Query Name>, dbFailOnError
instead of the openquery command?

I'm guessing that you are not turning off the error messages, etc.

See:
http://www.utteraccess.com/forum/Openquery-runSQL-t1832567.html
0
 

Accepted Solution

by:
Tylendal1 earned 0 total points
ID: 33641154
Not sure what the issue was but I converted the query to a SQL statement and use db.Execute mSQL and it worked just fine. The query I was attempting to run was an append query and was being lazy hoping the with acApp would work.  I'm sure there is additional syntax that could have been added that would have let it work.
Maybe someone can assist with what the issue is with the acApp code I show.
Fred
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 34941433
This question has been classified as abandoned and is being closed as part of the Cleanup Program. See my comment at the end of the question for more details.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question