8 Replies - 3564 Views - Last Post: 26 September 2012 - 02:19 AM Rate Topic: -----

#1 galoochi  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 11
  • Joined: 29-July 10

Running a VBS Script on a Network Share File

Posted 13 September 2012 - 05:14 PM

I'm trying to run a VBScript that calls a Microsoft Access database. When I have the database saved locally on my computer it runs just fine. Here's what it looks like:

Dim ConnectionString
ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=g:\database.mdb"
CN.Open ConnectionString



But when I have the database stored on a local network share, I get an error. The local network share shortcut is \\hp\e, so I've been trying the following:

Dim ConnectionString
ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\\hp\e:\database.mdb"
CN.Open ConnectionString



But it's not working. What am I doing wrong? Thanks!!!

Is This A Good Question/Topic? 0
  • +

Replies To: Running a VBS Script on a Network Share File

#2 BobRodes  Icon User is offline

  • Your Friendly Local Curmudgeon
  • member icon

Reputation: 572
  • View blog
  • Posts: 2,986
  • Joined: 19-May 09

Re: Running a VBS Script on a Network Share File

Posted 15 September 2012 - 07:48 PM

nothing wrong with your syntax. Perhaps e: isn't shared?
Was This Post Helpful? 0
  • +
  • -

#3 maj3091  Icon User is online

  • D.I.C Lover
  • member icon

Reputation: 299
  • View blog
  • Posts: 1,768
  • Joined: 26-March 09

Re: Running a VBS Script on a Network Share File

Posted 16 September 2012 - 12:53 AM

Maybe it's just a typo in your post, but you refer to the share as "\\hp\e" then try to reference it in your code as "\\hp\e:"
Was This Post Helpful? 0
  • +
  • -

#4 thava  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 180
  • View blog
  • Posts: 1,606
  • Joined: 17-April 07

Re: Running a VBS Script on a Network Share File

Posted 16 September 2012 - 11:40 PM

i think the : might be the problem remove it,
Was This Post Helpful? 1
  • +
  • -

#5 galoochi  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 11
  • Joined: 29-July 10

Re: Running a VBS Script on a Network Share File

Posted 19 September 2012 - 11:10 AM

View PostBobRodes, on 15 September 2012 - 07:48 PM, said:

nothing wrong with your syntax. Perhaps e: isn't shared?


e: is definitely shared, I can open the files on it, I just can't successfully run this script :( Very frustrated...

Could it be a problem that I'm running Windows 7 and the HP I'm networking with is running XP?
Was This Post Helpful? 0
  • +
  • -

#6 BobRodes  Icon User is offline

  • Your Friendly Local Curmudgeon
  • member icon

Reputation: 572
  • View blog
  • Posts: 2,986
  • Joined: 19-May 09

Re: Running a VBS Script on a Network Share File

Posted 21 September 2012 - 07:22 AM

View Postthava, on 17 September 2012 - 01:40 AM, said:

i think the : might be the problem remove it,

No, that's the right syntax for a mapped network drive. Galoochi, please tell the exact error and which line of code causes it.
Was This Post Helpful? 0
  • +
  • -

#7 galoochi  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 11
  • Joined: 29-July 10

Re: Running a VBS Script on a Network Share File

Posted 21 September 2012 - 01:14 PM

View Postthava, on 16 September 2012 - 11:40 PM, said:

i think the : might be the problem remove it,


I can't believe it, but this fixed it! I thought the colon was necessary for the network location, but I guess not. Thank you!
Was This Post Helpful? 0
  • +
  • -

#8 BobRodes  Icon User is offline

  • Your Friendly Local Curmudgeon
  • member icon

Reputation: 572
  • View blog
  • Posts: 2,986
  • Joined: 19-May 09

Re: Running a VBS Script on a Network Share File

Posted 25 September 2012 - 06:06 AM

So did I! Thava, feel free to explain further...
Was This Post Helpful? 0
  • +
  • -

#9 thava  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 180
  • View blog
  • Posts: 1,606
  • Joined: 17-April 07

Re: Running a VBS Script on a Network Share File

Posted 26 September 2012 - 02:19 AM

normally a shared resource can be accessed in the explorer like this

name of the shared computer is hp
then we should use like this
\\hp
name of the shared folder or shared drive is e then
\\hp\e
if it contains a database.mdb file and we need to open it
we should type like this
\\hp\e\database.mdb

but the OP has wrongly typed it in his connection string
like this
\\hp\e:\database.mdb

that's why i say just remove the : from the path
i think maj3091 also mention the same thing

This post has been edited by thava: 26 September 2012 - 02:19 AM

Was This Post Helpful? 1
  • +
  • -

Page 1 of 1