Results 1 to 4 of 4
  1. #1
    boykendeng is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2013
    Posts
    3

    moving deleted files on a archive tables in access using vb6

    someone PLEASe HELP!!!!!!

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Maybe you'll find this link helpful: http://allenbrowne.com/ser-37.html

  3. #3
    boykendeng is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2013
    Posts
    3
    Quote Originally Posted by RuralGuy View Post
    Maybe you'll find this link helpful: http://allenbrowne.com/ser-37.html

    in my vb this is my code on my command button delete
    Private Sub Command3_Click()
    If MsgBox("Are you sure?", vbQuestion + vbYesNo, "Delete Record") = vbYes Then
    Adodc1.Recordset.Delete
    MsgBox "Record Deleted", vbInformation, "Delete"
    End If
    End Sub

    and also i have 2 tables items and archive_items
    i already have append and delete querry

    what should i do next?
    please help

  4. #4
    boykendeng is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2013
    Posts
    3
    Quote Originally Posted by RuralGuy View Post
    Maybe you'll find this link helpful: http://allenbrowne.com/ser-37.html
    sir i keep receiving an error user-defined is not defined

    ihave a table named AutoSupply.mdb and i already created append and delete query

    Private Sub cmdDelete_Click()
    Call DoArchive


    End Sub
    Sub DoArchive()
    On Error GoTo Err_DoArchive
    Dim ws As DAO.Workspace 'Current workspace (for transaction).
    Dim db As DAO.Database 'Inside the transaction.
    Dim bInTrans As Boolean 'Flag that transaction is active.
    Dim strSql As String 'Action query statements.
    Dim strMsg As String 'MsgBox message.


    'Step 1: Initialize database object inside a transaction.
    Set ws = DBEngine(0)
    ws.BeginTrans
    bInTrans = True
    Set db = ws(0)


    'Step 2: Execute the append.
    strSql = "INSERT INTO AutoSupply ( SupplierNumber, SupplierName, Address, ContactNumber ) " & _
    "IN ""C:\Users\3m\Desktop\Auto Supply\Auto Supply\DB\AutoSupply.mdb"" " & _
    "SELECT SupplierNumber, SupplierName, Address, ContactNumber FROM AutoSupply WHERE (MyYesNoField = True);"
    db.Execute strSql, dbFailOnError


    'Step 3: Execute the delete.
    strSql = "DELETE FROM AutoSupply WHERE (MyYesNoField = True);"
    db.Execute strSql, dbFailOnError


    'Step 4: Get user confirmation to commit the change.
    strMsg = "Archive " & db.RecordsAffected & " record(s)?"
    If MsgBox(strMsg, vbOKCancel + vbQuestion, "Confirm") = vbOK Then
    ws.CommitTrans
    bInTrans = False
    End If


    Exit_DoArchive:
    'Step 5: Clean up
    On Error Resume Next
    Set db = Nothing
    If bInTrans Then 'Rollback if the transaction is active.
    ws.Rollback
    End If
    Set ws = Nothing
    Exit Sub


    Err_DoArchive:
    MsgBox Err.Description, vbExclamation, "Archiving failed: Error " & Err.Number
    Resume Exit_DoArchive


    End Sub

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Moving ALL Files in a Folder
    By JoeM in forum Programming
    Replies: 4
    Last Post: 04-19-2013, 01:59 PM
  2. Active & Archive Tables Identical but Different?
    By Instructor Support in forum Database Design
    Replies: 1
    Last Post: 08-17-2012, 12:27 AM
  3. Replies: 2
    Last Post: 04-10-2012, 11:03 AM
  4. Replies: 3
    Last Post: 08-29-2011, 03:11 PM
  5. Replies: 2
    Last Post: 01-06-2011, 08:02 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums