Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Error 2455: You entered an expression that has an invalid reference to the property visible

Posted on 2003-03-27
2
Medium Priority
?
1,247 Views
Last Modified: 2007-12-19
I get the following error message when using automation to control MSAccess.

"Error 2455: You entered an expression that has an invalid reference to the property visible"

MSAccess has user-level security.  To bypass this using automation, I have shelled out, passing the necessary parameters available when opening MSAccess from command line.  Then I have captured the instance using GetObject(, "Access.Application").

Here's the relevant section of VB code...

    On Error Resume Next
        Set GetoAcc = GetObject(, "Access.Application")
       
        If Err <> 0 Then ' No instance of MS Access is open.
            If IsMissing(varUser) Then varUser = "Admin"
           
            cmdLine = AccPath
            cmdLine = cmdLine & " /nostartup /user " & varUser
           
            If Not IsMissing(varPwd) Then cmdLine = cmdLine & " /pwd " & varPwd
           
            Shell PathName:=cmdLine, WindowStyle:=0
            On Error GoTo WaitForAccess
                Set GetoAcc = GetObject(, "Access.Application")
            On Error Resume Next
        End If
 
        GetoAcc.visible = True


It is on the last line that I get this error message.  HELP!


0
Comment
Question by:IqbalHamid
2 Comments
 
LVL 59

Accepted Solution

by:
Jim Dettman (Microsoft MVP/ EE MVE) earned 200 total points
ID: 8217812
What is it that your trying to achieve?  You can specify the window argument on the shell command.

Take a look at:

HOWTO: Automate a Secured Access Database Using Visual Basic
http://support.microsoft.com/default.aspx?scid=kb;en-us;192919

Also, I don't see where your specifying the /wrkgrp switch.  It's not causing the error, but may be a problem down the road.

Jim.
0
 

Author Comment

by:IqbalHamid
ID: 8225910
Thank you Jim.  That site was exactly what I required.

Just FYI, I had an MS Access database with BOTH user-level security AND database password set.

It is not possible to directly access OLE automation of MSAccess in such a scenario because it is not possible to pass ALL the necessary security info (UserName, UserPassword and Database Password) via parameters.

I have got around user-level security by shelling out and taking advantage of sitches available during command line launch, THEN capturing that instance using GetObject(, "Access.Application").

I got round the 2nd problem of the database password by opening up the MSAccess instances DBEngine object using DAO, passing in the database password as a parameter there.
Eg:

    GetoAcc.DBEngine.DefaultUser = varUser      
    GetoAcc.DBEngine.DefaultPassword = varPwd
    GetoAcc.DBEngine.SystemDB = sWIF
    Set wks = GetoAcc.DBEngine.CreateWorkspace("wks", varUser, varPwd, dbUseJet)
    Set db = wks.OpenDatabase(sDBPath, False, False, "MS Access;UID=" & varUser & ";PWD=AnUbhalAsAirde")
   
    ' Open the database within oAcc...
    GetoAcc.OpenCurrentDatabase sDBPath, False


I wanted the MSAccess instance invisible most of the time except later when previewing reports I needed to make it temporarily visible but was getting the above error message.

Thanks again for your help!
0

Featured Post

Technology Partners: 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

Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
Implementing simple internal controls in the Microsoft Access application.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

571 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