+ Reply to Thread
Results 1 to 14 of 14

VB delete Access rows from table on condition

Hybrid View

ceemo VB delete Access rows from... 09-27-2006, 04:26 PM
ceemo stuck 10-01-2006, 12:25 PM
ceemo anyone 10-06-2006, 01:18 AM
ions I don't understand what you... 10-06-2006, 04:30 PM
ceemo ah ha 10-07-2006, 10:22 AM
  1. #1
    Forum Contributor
    Join Date
    06-15-2004
    Posts
    246

    VB delete Access rows from table on condition

    I want to be able to delete rows from a an access query where a condition (date) is met within the table?

  2. #2
    Forum Contributor
    Join Date
    06-15-2004
    Posts
    246

    stuck

    im still stuck with this one guys any advise?

  3. #3
    Forum Contributor
    Join Date
    06-15-2004
    Posts
    246

    anyone

    anyone know if this can even be done?

  4. #4
    Registered User
    Join Date
    10-06-2006
    Posts
    82
    I don't understand what you are trying to do. Are you trying to do this within Access or Excel?

    Access forumn link
    http://www.access-programmers.co.uk/forums/

  5. #5
    Forum Contributor
    Join Date
    06-15-2004
    Posts
    246

    ah ha

    using excel vb code i would like to delete records from an access table based on a criteria

  6. #6
    Forum Expert
    Join Date
    11-23-2005
    Location
    Rome
    MS-Off Ver
    Ms Office 2016
    Posts
    1,628

    Delete access db record from excel

    To do what you asked do so:
    1) open excel and then Vb editor (alt + F11)
    2) from the menu, choose tools, references and, from the list, choose Microsoft DAO 3.6 object librery
    if you don't have 3.6 you can use also 3.51 or another

    3) paste this code:
    Sub DeleteRecords()
    Dim db As Database
    Dim dbName As String
    Dim query As String

    dbName = "c:\<path>\<db name>.mdb"

    'connect to access database
    Set db = dbengine.Workspaces(0).OpenDatabase(dbName)
    query = "delete from <rable name> where <field name> = 'criteria'"

    if your field is numeric don't use quote in criteria:
    query = "delete from <rable name> where <field name> = criteria"

    'deleting
    db.Execute (query)
    db.Close
    Set db = Nothing

    End Sub

    Regards.
    Antonio

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1