Solved

Getting Office Automation to work within VB6

Posted on 2010-09-01
4
426 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
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 100

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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

707 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now