Results 1 to 7 of 7
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Serbia and Montenegro (Yugoslavia)
    Posts
    342
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Syntax of Update Statement (VB6)

    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.

  2. #2
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,624
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: Syntax of Update Statement (VB6)

    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.
    Wendell

  3. #3
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Syntax of Update Statement (VB6)

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

  4. #4
    2 Star Lounger
    Join Date
    Nov 2001
    Location
    London, UK, England
    Posts
    116
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Syntax of Update Statement (VB6)

    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?

  5. #5
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Syntax of Update Statement (VB6)

    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.
    Charlotte

  6. #6
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Serbia and Montenegro (Yugoslavia)
    Posts
    342
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Syntax of Update Statement (VB6)

    Hi Dylan,

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

  7. #7
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Serbia and Montenegro (Yugoslavia)
    Posts
    342
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Syntax of Update Statement (VB6)

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •