?
Solved

Set App = GetObject

Posted on 2006-04-14
3
Medium Priority
?
217 Views
Last Modified: 2008-02-01
I need help with this code.  I need to click a command button in excel and open Access to a certain "Form" and Hardcode the password.


I get a code "File name or class name not found during automation operation"

Any help would be greatly appreciated

    'Open a form in Access
    Dim App As Object
   
       Set App = GetObject("\\Dtcnas-ilsp002\mandatory\Analysts - Working Files\Carol\Demo\Volume.mdb;Jet OLEDB:Database Password=OPPS;")
   
     App.Open    
     App.Application.DoCmd.RunMacro "Macro2CloseSwitchboard"
     App.Application.DoCmd.openform "Form"
 

0
Comment
Question by:ca1358
2 Comments
 
LVL 26

Expert Comment

by:EDDYKT
ID: 16458519
1. don't use app

app is reserve word in vb

try something else

iu.e

dim App1 as object
0
 
LVL 44

Accepted Solution

by:
Leigh Purvis earned 2000 total points
ID: 16460243
Perhaps something like

'Open a form in Access
Dim objAccess As Object

Set objAccess = CreateObject("Access.Application")

With objAccess
    .OpenCurrentDatabase "\\Dtcnas-ilsp002\mandatory\Analysts - Working Files\Carol\Demo\Volume.mdb", , "OPPS"
    .DoCmd.RunMacro "Macro2CloseSwitchboard"
    .DoCmd.OpenForm "Form"
    .UserControl = True
End With

Set objAccess = Nothing
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
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…
Suggested Courses
Course of the Month14 days, 14 hours left to enroll

840 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