![]() |
Help with Error
When my code hit this line cn.Open "Provider=Microsoft.Jet.OLEDB.4.0; " & "Data Source = Trade_Limit" error read couldnt find path "Counld find path \\Dtcnas-ilsp002\mandatory\Analysts - Working Files\Carol\Demo\Trade_Limit Since it is not a drive, is there someother snytax? Dim adoCN As ADODB.Connection Dim strSQL As String Const DatabasePath As String = " \\Dtcnas-ilsp002\mandatory\Analysts - Working Files\Carol\Demo\Trade_Limit" Public Function DBVLookUp(End_of_year_incentive As String, _ As400 As String, _ A1 As String) As Variant Dim adoRS As ADODB.Recordset If adoCN Is Nothing Then SetUpConnection Set adoRS = New ADODB.Recordset strSQL = "SELECT * FROM " & End_of_year_incentive & _ " WHERE " & As400 & "=" & A1 & ";" adoRS.Open strSQL, adoCN, adOpenForwardOnly, adLockReadOnly If adoRS.BOF And adoRS.EOF Then DBVLookUp = "Value not Found" Else DBVLookUp = adoRS.Fields(Package).Value End If adoRS.Close End Function Sub SetUpConnection() On Error GoTo ErrHandler Set cn = New ADODB.Connection cn.Open "Provider=Microsoft.Jet.OLEDB.4.0; " & "Data Source = Trade_Limit" Exit Sub ErrHandler: MsgBox Err.Description, vbExclamation, "An error occurred" End Sub |
All times are GMT +1. The time now is 01:06 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com