Results 1 to 4 of 4
  1. #1
    Eranka is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Dec 2017
    Posts
    150

    Deleting Multiple Records

    Hi Guys,



    when i type a value in the textbox, the delete button has to delete all the records related to the textbox value in the table. How to do this delete button click. Appreciate for your help guys.

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Execute a delete query that uses the textbox in the criteria nn
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Eranka is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Dec 2017
    Posts
    150
    Hi

    Code:
    If MsgBox("Do you wish to delete this record?", vbYesNo, "Delete Confirmation") = vbYes Then		If MsgBox("Are you SURE you want to delete this record?" & vbCrLf & _
         		"This will permanently delete the record.", vbYesNo, "2nd Delete Confirmation") = vbYes Then
    			CurrentDb.Execute "DELETE * FROM [TableName] WHERE [FieldName] = '" & Me.TextBox0 & "';" 
    			MsgBox "Records Of Semester " & Me.TextBox0 & " Deleted Successfully"
    		End If
    	End If
    used above code, and its deletes every records in the table.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Thread is marked solved; is it? If not, use this to see the finished SQL:

    http://www.baldyweb.com/ImmediateWindow.htm

    your code should only delete records meeting the criteria.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Deleting records from a query
    By banpreet in forum Queries
    Replies: 1
    Last Post: 03-03-2017, 03:39 PM
  2. Replies: 2
    Last Post: 05-15-2013, 09:03 PM
  3. Deleting multiple records selected in a Listbox
    By ankitmehtta in forum Access
    Replies: 4
    Last Post: 11-08-2011, 01:20 PM
  4. Replies: 1
    Last Post: 08-09-2011, 11:26 PM
  5. deleting records
    By radicalrik in forum Queries
    Replies: 2
    Last Post: 07-14-2010, 03:10 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