Results 1 to 8 of 8
  1. #1
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Delete record based index... (2000 sr-1)

    in column AA of sheet1 have a value similar unique index.
    in column 22 of table of access mdb have same unique index present in AA column of sheet1
    admit i scroll value in userform with
    part of code:

    '''''''''''''''''
    RIGA = ScrollBar1.Value
    UNIQUE_TEST= Sheets(FOGLIO).Cells(RIGA, "AA").Value
    ''''''''''''''''''

    How to assign to a new button a macro to intercept in column 22 of table the value assigned to UNIQUE_TEST and delete in table entire line identified with UNIQUE_TEST ...

    hope im clear...

    tks.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Delete record based index... (2000 sr-1)

    Set a reference to the Microsoft ActiveX Data Objects 2.1 Library.
    In your code:
    - Create and open an ADODB.Connection object that refers to the database. You already know how to do this.
    - Delete the record using this line:

    cnn.Execute "DELETE * FROM [NameOfTable] WHERE [NameOfField] = " & UNIQUE_TEST

    - Substitute the correct names for the connection cnn and of the table and field.
    - The above assumes that the field is a number field. If it is a text field, use

    cnn.Execute "DELETE * FROM [NameOfTable] WHERE [NameOfField] = " & Chr(34) & UNIQUE_TEST & Chr(34)

    Chr(34) is the double quote character <code>"</code>

  3. #3
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Delete record based index... (2000 sr-1)

    tks for explain i make a code topmorrow....
    But only a curiosity, why you suggest me "Microsoft ActiveX Data Objects 2.1 Library" always and not 2.5, or 2.7 or 2.8 i have all of thsi library in my reference window...
    Peraphs to be sure the other user not have a new version....? 2.1 is the default installed in Office?

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Delete record based index... (2000 sr-1)

    You could use the newer versions too, but ADO 2.1 is the version that was shipped with Office 2000, so it's probably safest to us that.

  5. #5
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Delete record based index... (2000 sr-1)

    aaaaaaaaaaaaah
    Tks now all is clear!

  6. #6
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Delete record based index... (2000 sr-1)

    Code maked, (Simple for me and not for tomorrow <img src=/S/smile.gif border=0 alt=smile width=15 height=15>) but see the image....
    the entire line is deleted but have #eliminato? wath id this?
    my code:
    Sub CANCELLA_RECORD(UNIQUE_TEST)

    Dim PROVADatabase As Object
    Set PROVADatabase = CreateObject("ADODB.Connection")
    PROVADatabase.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source='" & gPROVADatabasePath & "'; User Id=admin; Password=;"

    PROVADatabase.Execute "DELETE * FROM [LUST091] WHERE [PROVA27] = " & Chr(34) & UNIQUE_TEST & Chr(34)

    PROVADatabase.Close
    Set PROVADatabase = Nothing

    End Sub

  7. #7
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Delete record based index... (2000 sr-1)

    If the table is open in Access while you delete a record, you'll see #Deleted (#Eliminato) in all fields. If you close and reopen the table, the record should disappear.

  8. #8
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Delete record based index... (2000 sr-1)

    waw!!!!!!!!!!
    Saved me!
    In effect you are right.(Always)
    Tks.

Posting Permissions

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