Microsoft access cant find file on path

Viewed 42

Hello I keep getting an error message saying the path is wrong. I'm new at VBA Code and I just don't know how to solve it. This is what I wrote. I keep checking the path every time and copy-pasting the path and yet it can't find it. Sorry for my English - not main language.

Error message is:

Run time errror
Could not find file A:\Proccess_Assig1.accdb'.

The code is

Private Sub btn_buscar_Click()
    Dim rs As New ADODB.Recordset
    Dim conn As New ADODB.Connection
    Dim strsql As String

    strsql = "Select * from TBlClientes Where id= " & txtCliente.Value & ""
    conn.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=A:\Proccess_Asig1.accdb;persist security Info=False"
    conn.Open
    rs.Open strsql, conn
    If rs.EOF Then
        MsgBox "Id no existe"
        txtCliente.Value = Nothing
        txtNombre.Value = Nothing
        txtApellido.Value = Nothing
        txtTelefono.Value = Nothing
    Else
        txtCliente.Value = rs.Fields("Nombre")  
        txtApellido.Value = rs.Fields("ApellidoPaterno")
        txtTelefono.Value = rs.Fields("Teléfono")
    End If
    rs.Close
    conn.Close

    Set conn = Nothing
    Set rs = Nothing
End Sub
0 Answers
Related