• Syntax of Update Statement (VB6)

    Author
    Topic
    #389593

    I’m trying to get this update statement to work against an Access 2K back end.

    cnAdmin.Execute (“UPDATE tblPath SET tblPath.StoredPath = ‘” & SysDefaults.DocRoot & ” ” & Mid$(tblPath.StoredPath, 29) & “‘;”)

    SysDefaults.DocRoot evaluates to a directory name and is a type variable. The error I’m getting is Object Required.

    Viewing 3 reply threads
    Author
    Replies
    • #688744

      You need to specify what record or records you are updating with a Select clause presumably – if you have Access at your disposal, create the query in the Query Grid, and then switch to the SQL view and you will see the sort of statement generally required.

    • #688797

      Do you really need the outer round brackets outside of the quotes, or for that matter, at all?

    • #690422

      As far as I can see, there are 3 objects expected in this statement (cnAdmin, SysDefaults & tblPath). Are all 3 supposed to be objects (tblPath.StoredPath ??) and are they all valid within the scope of the statement?

      • #692908

        Hi Dylan,

        You are correct. cnAdmin is the connection object, sysDefaults is a type variable, and tblPath is part of an ADODB.RECORDSET

    • #690428

      Mike,

      The problem is that you are dragging SysDefaults.DocRoot from nowhere. the rest of the SQL would be OK without that but the query engine doesn’t have any way to evaluate SysDefaults.DocRoot since you don’t have any kind of SELECT statement or subquery in there to tell the engine what SysDefaults is and where DocRoot comes from. You’re trying to use the syntax for a single table update.

      • #692910

        Charlotte,

        SysDefaults.DocRoot is a global type variable that will translate to a UNC path. Though I acknowledge that this still may be the issue, I apologize for not being more descriptive on the variables. I thought this might have just been a syntax issue with the SQL statement.

    Viewing 3 reply threads
    Reply To: Syntax of Update Statement (VB6)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: