I need help with an SQL DELETE statement using Access97, ADO
and VB. I'm getting the error message
'No Value given for one or more required parameters'
I have tried every which way to make it work.
My code is as follows.
Private Sub cmdDelete_Click()
Dim strSQL As String
Dim cnAP As Connection
Dim cmdSchool As Command
Set cnAP = New Connection
Set cmdSchool = New Command
cnAP.CursorLocation = adUseClient
cnAP.Open "Provider=Microsoft.Jet.OLEDB.3.51;Persist Security Info=False;Data Source=C:\project\Student.mdb"
cmdSchool.ActiveConnection = cnAP
cmdSchool.CommandType = adCmdText
strSQL = "DELETE * FROM School WHERE School = 'txtName'"
cmdSchool.CommandText = strSQL
cmdSchool.Execute
adoSchool.Refresh
end sub
Can anyone tell me the correct statement. I want to be able to delete out the chosen record.
Many thanks in advance.
John
and VB. I'm getting the error message
'No Value given for one or more required parameters'
I have tried every which way to make it work.
My code is as follows.
Private Sub cmdDelete_Click()
Dim strSQL As String
Dim cnAP As Connection
Dim cmdSchool As Command
Set cnAP = New Connection
Set cmdSchool = New Command
cnAP.CursorLocation = adUseClient
cnAP.Open "Provider=Microsoft.Jet.OLEDB.3.51;Persist Security Info=False;Data Source=C:\project\Student.mdb"
cmdSchool.ActiveConnection = cnAP
cmdSchool.CommandType = adCmdText
strSQL = "DELETE * FROM School WHERE School = 'txtName'"
cmdSchool.CommandText = strSQL
cmdSchool.Execute
adoSchool.Refresh
end sub
Can anyone tell me the correct statement. I want to be able to delete out the chosen record.
Many thanks in advance.
John