Results 1 to 6 of 6
  1. #1
    Join Date
    Dec 2007
    Posts
    26

    Unanswered: Execute a SQL Delete Statement

    I need to execute a delete sql statement. It has a ADO Connection


    ADO Connection………..

    SQL = "Delete * FROM property WHERE propertyid= 14 "

    objConn.Execute SQL ????
    Execute (what is the code to execute the SQL)


    Casey

  2. #2
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    I think it's

    Application.Execute SQL
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  3. #3
    Join Date
    Sep 2007
    Location
    Global Village
    Posts
    185

    Wink

    Your code is correct it should be:
    PHP Code:
    dim strSQL as string
    Dim objConn 
    As ADODB.Connection
    Dim objRST 
    As ADODB.Recordset
    Set objConn 
    CurrentProject.Connection
    Set objRST 
    = New ADODB.Recordset
    strSQL
    ="your SQL string"

    objConn.open

    ' this is for recordset opening you can delete it if you dont use it
    objRST.Open strSQL, objConn, adOpenStatic, adLockOptimistic

    objConn.Execute strSQL

    objRST.Close
    objConn.Close
    Set objRST = Nothing
    Set objConn = Nothing 
    Cheers

  4. #4
    Join Date
    Dec 2007
    Posts
    26
    Thanks
    StarTrekker
    and
    Thanks Aran1

    It works. I just needed to tidy up the rest of the code as per your examples
    much appreciated.

    its midnight here in Australia bed time, Thanks again

    Casey

  5. #5
    Join Date
    Sep 2007
    Location
    Global Village
    Posts
    185
    you are wellcome

  6. #6
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    ... Most welcome
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

Posting Permissions

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