Windows Vista Forums

Connection to Access fails
  1. #1


    JT Guest

    Connection to Access fails

    Hi

    I'm testing a connection to an Access database and looking up a filename
    in a column but I keep getting an error with the following code :

    Line3 Char5 - Object doesn't support this property or method
    :'oCmd.Connection'


    Function DoExecSQL(SQL,Params,Opt)
    Set oCmd = CreateObject("ADODB.Command")
    Set oCmd.Connection = oConn
    oCmd.CommandText = SQL
    Set DoExecSQL = oCmd.Execute(, Params, Opt)
    End Function

    Function ExecSQL(SQL, Params)
    Set ExecSQL = DoExecSQL(SQL, Params, 0)
    End Function

    Function ExecSQLNoResults(SQL, Params)
    Set ExecSQL = DoExecSQL(SQL, Params, 128)
    End Function

    Function GetDocumentFlag(Doc)
    Set oRs = ExecSQL("SELECT * FROM FLAG WHERE FILENAME=?", Array(Doc))
    If NOT oRs.EOF Then
    GetDocumentFlag = oRs("FLAG").Value
    Else
    GetDocumentFlag = 0
    End If
    End Function

    Set oConn = CreateObject("ADODB.Connection")

    oConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data
    Source=c:\test.mdb;Persist Security Info=False"

    oConn.Open


    If GetDocumentFlag("thefilename") = True Then
    MsgBox "found filename"
    Else
    MsgBox "not found filename"
    End If



    I'm not sure why the error - any thoughts ?

    Thanks

    JT

      My System SpecsSystem Spec

  2. #2


    ekkehard.horner Guest

    Re: Connection to Access fails

    JT schrieb:

    > Hi
    >
    > I'm testing a connection to an Access database and looking up a filename
    > in a column but I keep getting an error with the following code :
    >
    > Line3 Char5 - Object doesn't support this property or method
    > :'oCmd.Connection'
    >
    >
    > Function DoExecSQL(SQL,Params,Opt)
    > Set oCmd = CreateObject("ADODB.Command")
    > Set oCmd.Connection = oConn
    > oCmd.CommandText = SQL
    > Set DoExecSQL = oCmd.Execute(, Params, Opt)
    > End Function
    [...]
    Set oCmd.ActiveConnection = oConn

      My System SpecsSystem Spec

  3. #3


    JT Guest

    Re: Connection to Access fails

    thanks!

    ekkehard.horner wrote:

    > JT schrieb:

    >> Hi
    >>
    >> I'm testing a connection to an Access database and looking up a
    >> filename in a column but I keep getting an error with the following
    >> code :
    >>
    >> Line3 Char5 - Object doesn't support this property or method
    >> :'oCmd.Connection'
    >>
    >>
    >> Function DoExecSQL(SQL,Params,Opt)
    >> Set oCmd = CreateObject("ADODB.Command")
    >> Set oCmd.Connection = oConn
    >> oCmd.CommandText = SQL
    >> Set DoExecSQL = oCmd.Execute(, Params, Opt)
    >> End Function
    > [...]
    > Set oCmd.ActiveConnection = oConn

      My System SpecsSystem Spec

Connection to Access fails problems?

Similar Threads
Thread Thread Starter Forum Replies Last Post
Connection to Sql-7 Database Fails George SBS Server 1 24 Mar 2010
connection fails daily fcsark9handler Vista mail 6 19 Dec 2009
Email access OK but Web access fails LarCrow Network & Sharing 3 15 Jun 2009
Network Connection Fails from One Laptop but not the other Hemisphere Dancer Vista networking & sharing 2 27 Feb 2008
VPN connection was working, now fails with error 651 jahyen Vista networking & sharing 2 26 Feb 2007