Results 1 to 6 of 6
  1. #1
    dwcolt is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    May 2011
    Posts
    5

    Error message when mapping network drive

    This is driving me crazy. I have a button that maps a network drive. Here is the code:



    Dim objNetwork
    Dim fs As Object
    Set objNetwork = CreateObject("WScript.Network")
    Set fs = CreateObject("Scripting.FileSystemObject")
    objNetwork.MapNetworkDrive "I:", "\\10.100.1.10"

    The first time I click on the button (when the network drive is not yet mapped), it maps the drive just fine, but then I get this error message:

    "The command or action " isn't available now"
    * You may be in a read-only database or an unconverted database from an earlier version of Microsoft Access
    * The type of object the action applies to isn't currently selected or isn't in the active view.

    The database isn't read-only and it's an Access 2007 database created from scratch.

    Now if I click on the button again (when the drive is already mapped), no error message. This is incredibly frustrating because on 4 of my machines (which are running identical versions of Windows 7, Access, etc.), there is never an error. But for some reason on a brand new machine I just installed last night, I am getting this error.

    Any help would be GREATLY appreciated!!

  2. #2
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    what's different about the new machine?

    have you stepped through it line by line yet to see where it trips up?

  3. #3
    dwcolt is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    May 2011
    Posts
    5
    As far as I can tell, absolutely nothing about the new machine is different.

    the code trips up when it actually maps the network drive. The strange thing is that the drive DOES map just fine, but then I get that error message in Access.

    I threw in a line to display a message box with the error number when this happens. Curiously, it displays "0" as the error number.

    I can't clear the error with traditional means. For example, if I do something like "IF Err.number=0 then err.clear", it still displays the same message. The only workaround I've been able to find is for error 0 to trigger a message box (which halts code execution). Then when I hit ok on the message box, the error message doesn't display.

    this is just infuriating. Any insight will sure be helpful!

  4. #4
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    http://msdn.microsoft.com/en-us/libr...(v=vs.85).aspx

    maybe there's an issue with the machine's rights? obviously the drive is shared, otherwise it would error on any machine. if it's new, are you sure the perms are the same, etc...??

    if the drive does map anyway, I would doubt any of the above would be true. could it be possibly a setting in vba?

    just throwing ideas to ya. I would guess that if you made a list of settings that were changed on any of the old machines and compared them with the newbie machine, you'd find the answer.

  5. #5
    dwcolt is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    May 2011
    Posts
    5
    Thanks. I've been through that article and verified that everything is correct. This is just infuriating. As I said, the drive maps just fine, so it doesn't appear to be a permissions issue. And of course my VB code is the same from one computer to the next.

    I've tried every permutation of the mapnetworkdrive commands and still end up with the same error. From other searches, this error seems to come up when you are trying to perform an action on an object that is hidden, but that doesn't appear to be the case here. Mind boggling!!

  6. #6
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    not sure how to help at this point. good luck to ya, sir.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 17
    Last Post: 06-04-2012, 05:11 PM
  2. Network Error 3043
    By khalid in forum Programming
    Replies: 10
    Last Post: 05-15-2011, 02:49 AM
  3. Replies: 1
    Last Post: 04-11-2011, 12:34 PM
  4. Output tables to an excel file on a network drive
    By GraemeG in forum Import/Export Data
    Replies: 1
    Last Post: 04-01-2011, 03:06 PM
  5. Replies: 0
    Last Post: 05-24-2006, 09:26 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums