?
Solved

Getting Office Automation to work within VB6

Posted on 2010-09-01
4
Medium Priority
?
434 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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 …
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

752 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