Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Getting Office Automation to work within VB6

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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Over the years I have built up my own little library of code snippets that I refer to when programming or writing a script.  Many of these have come from the web or adaptations from snippets I find on the Web.  Periodically I add to them when I come…
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…
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…
Suggested Courses
Course of the Month21 days, 1 hour left to enroll

810 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