I want to use a string variable when creating a connection to an Access Database in VB 6.0 so the user can select the file. I have created a form and the code to capture the file path and store it in a variable as follows.
g_strFile is stored as "C:\Practice\Stats.mdb"
Now I am trying to use that variable in the connection string:
Set Db = Ws.OpenDatabase (g_strFile)
When I run the program I get the following error: Run-time error '3055' Not a valid file name.
Is it possible to do what I am trying Any help would be appreciated.
Thanks

String Variables
osamaT
These forums are for VB.NET and there are better places to find answers for older versions of VB. Maybe the
VB6 newgroups - http://msdn.microsoft.com/newsgroups/default.aspx dg=microsoft.public.vb.general.discussion&lang=en&cr=US
Or perhaps the VB6 resource center
http://msdn.microsoft.com/vbrun/
or perhaps www.vbcity.com may be useful places to search for answers on VB6 related questions.
I'd verify if this was possible if you use a literal with this value rather than setting a variable.
Hopefully this helps.
Shabari
This is how I would go about it:
1) Connect to the MDB via ServerExplorer, see the connection string from the connection's properties, and build a string from what you see from there. An example follows:
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\TempMDB\GateScreenXP.mdb;Persist Security Info=True
- Adrian