Results 1 to 6 of 6
  1. #1
    azhar2006's Avatar
    azhar2006 is offline Expert
    Windows 7 32bit Access 2007
    Join Date
    Mar 2012
    Posts
    528

    delete button to somewhere else

    Hello all
    I created a query to the finished material effect put the delete button in this article form
    It also put this code deletion button
    The question is
    I want to finished material effect does not delete the real but go to another table or query
    Does not appear in the main table

    Private Sub Command15_Click()
    Dim intSeat As Integer
    If MsgBox("Click ""Yes"" to Confirm you want to delete this record.", vbYesNo, "Delete?") = vbYes Then


    intSeat = Me.Seat
    CurrentDb.Execute "Insert into QurNearExp1 (Exp, DataInpuot, InputTo,namdrag,mom,item,iddrag) SELECT Exp, DataInpuot, InputTo,namdrag,mom,item,iddrag FROM QurNearExp WHERE Seat = " & intSeat
    CurrentDb.Execute "Delete * FROM QurNearExp WHERE Seat = " & intSeat
    Me.Requery
    End If

    End Sub
    Is it possible to get an example of what I want

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    I would consider creating a Boolean field to indicate if the record is active or not. You are correct to not want to delete a record. The idea to move the record out of the table to a safe place is not a bad idea. I prefer to remove the record from the Recordset.

    Forms and reports depend on Recordsets. The data a query returns will complete this recordset for the form or report. Adjust your queries to recognize the value of a Boolean (Yes/No) field. You can archive a record/row by updating the Boolean field and having the query not retrieve records where the Boolean value equals -1 or yes.

    When you add a Boolean to your table, be sure to set the default to the desired value.

    My preference for an "Archive" field would be a default of 0 or "No/False". Then, when I want to delete or archive the record, I change the value to -1 or "Yes/True".

  3. #3
    azhar2006's Avatar
    azhar2006 is offline Expert
    Windows 7 32bit Access 2007
    Join Date
    Mar 2012
    Posts
    528
    Thank you very much ItsMe
    But how do I do it
    Is it possible ideas or example
    My preference for an "Archive" field would be a default of 0 or "No / False". Then, when I want to delete or archive the record, I change the value to -1 or "Yes / True".
    Thanks again

  4. #4
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    There are two queries in this sample DB. One will show the Archived records while the other will show the Active records.

    The queries use criteria for the Archive field to distinguish the status of the records in the table.
    Attached Files Attached Files

  5. #5
    azhar2006's Avatar
    azhar2006 is offline Expert
    Windows 7 32bit Access 2007
    Join Date
    Mar 2012
    Posts
    528
    Thank you very much ItsMe
    Is what I want

  6. #6
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    I am glad to hear that it makes sense!

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

Similar Threads

  1. delete button
    By azhar2006 in forum Forms
    Replies: 2
    Last Post: 02-22-2014, 01:49 PM
  2. delete button
    By msasan1367 in forum Access
    Replies: 2
    Last Post: 05-31-2013, 10:25 PM
  3. Delete query button?
    By jpalk in forum Queries
    Replies: 2
    Last Post: 10-14-2010, 09:12 AM
  4. Simple delete button on form
    By chessico in forum Forms
    Replies: 9
    Last Post: 10-15-2009, 03:14 PM
  5. Add/Delete Button
    By ocemy in forum Forms
    Replies: 1
    Last Post: 03-29-2009, 08:08 PM

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