×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

delete

delete

(OP)
Hello!

I am trying to delete a whole row of data in the data base.
I can't find the right code. I know how to change the existing data and then update the database but now, I am trying to delete a row and I can't. BTW, i am using ASP and Access for database.

Thanks and Cheers

ArshiA

RE: delete

This code would work

Dim DB as Database
Dim rstRecordset as Recordset

Set DB = DBEngine(0)(0)
Set rstRecordset = DB.Openrecordset(<<Your Recordset>>, _ DBOpenDynaset)

Do until rstRecordset.EOF
.delete
.movenext
Loop

Simple but don't know if this answers your question

RE: delete

' You can also use the following function to delete a specific record, or group of
' records that meet a specific criteria


Function DeleteRecords(strTblName As String, strFldName As String, strFldVal As String)
    ' strTableName is the name of the table that you want to remove the row (record) from.
    ' strFldName is the name of the field that you're searching for specific criteria in.
    ' strFldVal is the value, or criteria, that you want met, in order find records to delete.
    
    ' Also, this might be helpful for you: Access will prompt you, letting you know that you're going
    ' to delete X number of records. If you don't want this to happen, uncomment the following line
    ' as well as the line after the DoCmd line.
    ' MAKE SURE if you ever SetWarnings to False, that you turn them back on by the SetWarnings True.
    ' If you don't, you wont get ANY warnings for things you do (accidentaly click delete when a table
    '  is selected, and it's gone. No warnings. Bye bye.
    
    ' DoCmd.SetWarnings False
    DoCmd.RunSQL ("SELECT * FROM " & strTblName & " WHERE " & strFldName & " = '" & strFldVal & "';")
    ' DoCmd.SetWarnings True
End Function

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close