I'm using VB6 and Access 2000. I have three table in Access and two of which are related in one to may relation. I'm trying to delete from the child table some records through my
VB interface. I'm connecting to the database through the code. M able to add new records but not able to delete. I'm not able to join the tables also for deleting the records. If possible please send me the example code for this Please help
the code is given below:
Private Sub cmdDelete_Click()
'Declare Variables for Connection
Dim objConn As New ADODB.Connection
Dim objRS As New ADODB.Recordset
Dim intResponse As Integer
'Check IF the User Wants to Delete the Record
intResponse = MsgBox("Are You Sure To Delete The Agent From Record?", vbYesNo, "Delete Record")
If intResponse = 6 Then
'Create Connection
objConn.Open "dsn=Call_Tracker"
Set objRS = objConn.Execute("Select * From Tracker")
objRS.MoveFirst
Do Until objRS.EOF
'Create query to Delete From Tracker
sql1 = "DELETE FROM tracker Where Login_ID =" & txtID.Text
'Execute SQL statement
objConn.Execute sql1
objRS.MoveNext
Loop
'Close Connection
objConn.Close
End If
'Load the Form Again
txtID.Text = ""
Exit Sub
End Sub
:(