Hello All,
When trying to open a connection from a worksheet to an Access database I get the following error:
Run-time error '-2147467259(80004005)': Not a valid file name.
Here is the first part of the code where the error takes place:
The debugger points me to the red line.
Forum member CalcSux78 gave me the code (in this thread -> http://www.mrexcel.com/forum/excel-questions/910496-macro-export-individual-cells-table-access.html) and it worked perfectly in my private user drive but once I moved the file to a network drive I started getting errors. Initially I got "Authentication failed." because I accidentally deleted "Data Source=" from before the path\filename (oops) but after correcting that I now get the file name error.
I can promise that the file name is spelled correctly and I am connected to the network; has anyone encountered something like this before?
I appreciate all ideas and input!
Thanks.
When trying to open a connection from a worksheet to an Access database I get the following error:
Run-time error '-2147467259(80004005)': Not a valid file name.
Here is the first part of the code where the error takes place:
Code:
Public Const Conn As String = "Data Source=\Drive:\Folder\name.accdb;"
Private Sub Export_Click()
Dim rs As New ADODB.Recordset
Dim cn As New ADODB.connection
Dim tbl As String
tbl = "Table"
[COLOR=#ff0000]cn.Open "Provider=Microsoft.ACE.OLEDB.12.0; " & Conn[/COLOR]
rs.Open tbl, cn, adOpenKeyset, adLockOptimistic, adCmdTableDirect
The debugger points me to the red line.
Forum member CalcSux78 gave me the code (in this thread -> http://www.mrexcel.com/forum/excel-questions/910496-macro-export-individual-cells-table-access.html) and it worked perfectly in my private user drive but once I moved the file to a network drive I started getting errors. Initially I got "Authentication failed." because I accidentally deleted "Data Source=" from before the path\filename (oops) but after correcting that I now get the file name error.
I can promise that the file name is spelled correctly and I am connected to the network; has anyone encountered something like this before?
I appreciate all ideas and input!
Thanks.