app.path syntax

micky5009
10-18-2004, 01:23 AM
Hi all,


I have the following connection string and want to use the app.path command but have had little success:

sconnect = "provider=microsoft.jet.OLEDB.4.0;data source=c:\ado\db1.mdb;"

Could somebody please show me how to insert it into the above string.

kind regards

Mick

DaddyHarris
10-18-2004, 07:27 AM
What are you trying to do with app.path? Is the MDB going to be sitting in the application directory? If so then...

sconnect = "provider=microsoft.jet.OLEDB.4.0;data source = " & app.path & "db1.mdb"

HardCode
10-18-2004, 11:35 AM
What are you trying to do with app.path? Is the MDB going to be sitting in the application directory? If so then...

sconnect = "provider=microsoft.jet.OLEDB.4.0;data source = " & app.path & "db1.mdb"

One minor correction. You need to add the backslash after App.Path:

sconnect = "provider=microsoft.jet.OLEDB.4.0;data source = " & app.path & "\db1.mdb"


... otherwise you would get a result like:

C:\Program Files\Microsoft Visual Studio\VB98db1.mdb

micky5009
10-19-2004, 02:07 AM
Thanks very much guys

DaddyHarris
10-19-2004, 07:26 AM
One minor correction. You need to add the backslash after App.Path:

sconnect = "provider=microsoft.jet.OLEDB.4.0;data source = " & app.path & "\db1.mdb"


... otherwise you would get a result like:

C:\Program Files\Microsoft Visual Studio\VB98db1.mdb
OOPS!! Thanks for catching that!

NP Micky, good luck on your project.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum