Hi
I am trying to open a MS Access db via CommonDialog1. All is fine untill I click OPEN after selecting the db I want. What I then get is a dialog for ODBC entitled SELECT DATA SOURCE with two tabs: File Data Source or Machine Data Source. If I choose Machine Data Source and then MS Access I get a runtime error 3423 and the message that I cannot use ODBC to import from/export to or link an external Microsoft Jet or ISAM Database table to my database. I am really confused - why does the SELECT DATA SOURCE window appear at all?
If I run debug it fails at the following line of code:
Set db = ws.OpenDatabase(gf_strDbPath)
Please Helpme!

Place a breakpoint at the line and hover the mouse over the variable. Do you see if you actually have a full path and file name in the variable? Or goto the immediate window and type in ?gf_strDbPath and hit enter. Does the variable contain a fully qualified path and file name?

Good Luck

Hi
Thanks for your prompt reply.

I have carried out your suggestions and in both cases gf_strDbPath is = "". This must be because the program halts before the variable can be loaded with the path due to this extra window popping up regarding selecting an ODBC datasource and subsequently giving the error message. I still can't fathom why my program asks me to create a data source link with ODBC. I only ever use ODBC when creating a link to a data source for Report design using Crystal Report Writer.

Hi again

Problem solved!

Changed gf_strDbPath to cdlgMain.FileName because I have proved that the Path is there and it works - Yippeeeee!

Thanks again for your help.

I thought that might be the problem. Glad you got it solved. Now, if you don't mind could you please mark this thread resolved.

Thanks and Good Luck

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.