hey all,
Im working with
vb and access using ado connection object.
What Im trying to do is delete from 2 different tables under the same button.I have 2 sql statements
Code:
strSql = "DELETE * From products where family Like '" & lstfamily.Text & "%' And ProductID Like '" & lstProduct.Text & "%'"
strSql2 = "DELETE * From usages where family Like ' " & lstfamily.Text & "%' And ProductID Like '" & lstProduct.Text & "%'"
I then try to execute these statement like so.
Code:
If lstProduct.Text = "" Then
MsgBox "you must select a product"
Else
'Message Box function
intresponse = MsgBox(strMessage, vbYesNo + vbInformation, "Delete Verification")
If intresponse = vbYes Then
With dbConn
.Execute strSql2 'problem is here
.Execute strSql
End With
MsgBox "Successful Deletion of " & lstProduct.Text
resetscreen
Else
MsgBox "Record was not deleted.Either you cancelled the operation or you did not select a product"
resetscreen
End If
End If
However srtSql2 causes an error.the first sql statement works but the second statement doesnt.I pressume at this stage that the SQL is not the problem as the first statement,which is identical, works.I may be wrong there of course.The programm stops at
.Execute strSql2 and the message "no value given for one or more requested parameters" .