Help with Error

C

ca1358

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top