+ Reply to Thread
Results 1 to 12 of 12

How to view access file if already opened using VBA?

  1. #1
    Forum Contributor
    Join Date
    06-14-2010
    Location
    Toronto,Canada
    MS-Off Ver
    Excel 2003
    Posts
    145

    How to view access file if already opened using VBA?

    Hi,
    I searched and there are a ton of links on how to open access files using VBA, but I couln't find (or maybe i wasn;t looking in the right place) code on how to bring the access file in foreground if it's already opened. Below is the code I use with no luck.
    Please Login or Register  to view this content.
    Thanks
    Last edited by adds007; 11-29-2010 at 10:01 AM.

  2. #2
    Registered User
    Join Date
    11-22-2010
    Location
    Finland
    MS-Off Ver
    Excel 2003, 2007
    Posts
    95

    Re: How to view access file if already opened using VBA?

    To clarify: do you open access files with excel or with something else? Because with excel you could just use
    Please Login or Register  to view this content.
    with if-already-open-cases.
    An example file is never useless!

    Tried an example function of mine and got errors?
    - Had you found them, replace ; with , and , with .

  3. #3
    Forum Contributor
    Join Date
    06-14-2010
    Location
    Toronto,Canada
    MS-Off Ver
    Excel 2003
    Posts
    145

    Re: How to view access file if already opened using VBA?

    Yes, I want to open the access file or activate it if already open with a click of a button.

    Thanks for the answer (don;t know why I hadn;t thought of that), but it gave an run-time error 9: subscript out of range when executing it.

    I want to add that I also want to open the table and form once activated. The open function works fine with these two lines
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    11-22-2010
    Location
    Finland
    MS-Off Ver
    Excel 2003, 2007
    Posts
    95

    Re: How to view access file if already opened using VBA?

    That error seems to activate when the file name goes wrong within the code.

  5. #5
    Forum Contributor
    Join Date
    06-14-2010
    Location
    Toronto,Canada
    MS-Off Ver
    Excel 2003
    Posts
    145

    Re: How to view access file if already opened using VBA?

    The filename is correct, cuz I checked using watching and excuting line by line.
    I think the problem is the name of access file. In task manager, the access file just says "Microsoft Access" for some reason instead of the actual file name. I tried putting that in too tho with no luck.

  6. #6
    Registered User
    Join Date
    11-22-2010
    Location
    Finland
    MS-Off Ver
    Excel 2003, 2007
    Posts
    95

    Re: How to view access file if already opened using VBA?

    Hmm I executed the code to see what really happens when you try to open the same file. The file in question always pop-ups automatically into foreground when tried to open again.

    Did I miss something?

    Anyway here's the
    Please Login or Register  to view this content.

    Of course you would change the "D:\access.xml" into strPath.

  7. #7
    Forum Contributor
    Join Date
    06-14-2010
    Location
    Toronto,Canada
    MS-Off Ver
    Excel 2003
    Posts
    145

    Re: How to view access file if already opened using VBA?

    Thanks for the code, but that;s to open excel files.
    The code works fine, but opens .mdb in excel format, which I don;t want.
    I want to open the .mdb file in Access itself through Excel VBA, but check if it's already open (ACTIVATE it then open form and table also) or not (OPEN it).
    Thanks

  8. #8
    Registered User
    Join Date
    11-22-2010
    Location
    Finland
    MS-Off Ver
    Excel 2003, 2007
    Posts
    95

    Re: How to view access file if already opened using VBA?

    Oh :D My first post was to make sure that you especially wanted to use excel to open (and to edit) these files. Guess I wasn't clear enough :|

    This explains that task manager thing which I sort of didn't get. Well, I guess my level of VBA knowledge isn't enough for this so I'd better start idling and see if someone finds an answer

  9. #9
    Forum Contributor
    Join Date
    06-14-2010
    Location
    Toronto,Canada
    MS-Off Ver
    Excel 2003
    Posts
    145

    Re: How to view access file if already opened using VBA?

    K Thanks for providing support so far

  10. #10
    Forum Contributor
    Join Date
    06-14-2010
    Location
    Toronto,Canada
    MS-Off Ver
    Excel 2003
    Posts
    145

    Re: How to view access file if already opened using VBA?

    Any more ideas on how to bring an access file to foreground using excel VBA?

  11. #11
    Forum Contributor
    Join Date
    06-14-2010
    Location
    Toronto,Canada
    MS-Off Ver
    Excel 2003
    Posts
    145

    Re: How to view access file if already opened using VBA?

    OMG!
    After searching in vain, i finally found what to do. It's only one line command.
    It might not be exacly what i want, but it's the best i got right now.
    For those with similar problems, use the below code:
    Please Login or Register  to view this content.

  12. #12
    Registered User
    Join Date
    12-23-2013
    Location
    ARGENTINA
    MS-Off Ver
    Excel 2003
    Posts
    1

    Re: How to view access file if already opened using VBA?

    Took me the same amount of days to find that fricking line too!
    Thanks!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1