|
-
Sep 20th, 2006, 12:35 AM
#1
Thread Starter
Member
Deleting Specific Records How?
Hello ,
I have this simple program and just wondering why it behaves like this,
I just want to delete a single record on a table
but instead of deleting only one, it deleted all the fields on it what do i missing here?
Here is my sample code:
DELETE CODE:
Private Sub Command3_Click()
Dim rs As New ADODB.Recordset
Dim rsView As New ADODB.Recordset
rs.Open "Select * From jobrecord" & _
" Where trim(left(plateno, len('" & Text1.Text & "'))) = trim('" & Text1.Text & "')", connAuto, adOpenDynamic, adLockOptimistic
If MsgBox("Are you sure you want to delete selected record.?", vbExclamation + vbYesNo) = vbYes Then
connAuto.Execute "Delete From jobrecord " & _
"Where plateno = '" & rs.Fields("plateno") & "'"
End If
rsView.Open "Select * From JobReportQuery " & _
" Where trim(left(plateno, len('" & Text1.Text & "'))) = trim('" & Text1.Text & "')", connAuto, adOpenDynamic, adLockOptimistic
Set DataGrid1.DataSource = rsView
End Sub
please see attached file screen 1 and screen 2.
hoping for your help guys..
Thanks naz.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|