R
roy_ware
In the form, I display a purchase order. I click the delete button, and it
won't work. Here's the code:
Dim strPONumber As String
Dim strSQL As String
Dim db As Database
Dim rec As Recordset
Dim qdfAction As QueryDef
strPONumber = PONumber.Value 'PONumber is the primary key of the
table
strSQL = "DELETE * FROM [Purchase Orders] " _
& "WHERE [Purchase Orders].PONumber = " _
& strPONumber & ";"
Set db = CurrentDb()
Set rec = db.OpenRecordset("Purchase Orders")
Set qdfAction = db.OpenRecordset("Purchase Orders", strSQL)
qdfAction.Execute dbFailOnError
rec.Close
Set rec = Nothing
Me.Requery
What am I doing wrong??????
won't work. Here's the code:
Dim strPONumber As String
Dim strSQL As String
Dim db As Database
Dim rec As Recordset
Dim qdfAction As QueryDef
strPONumber = PONumber.Value 'PONumber is the primary key of the
table
strSQL = "DELETE * FROM [Purchase Orders] " _
& "WHERE [Purchase Orders].PONumber = " _
& strPONumber & ";"
Set db = CurrentDb()
Set rec = db.OpenRecordset("Purchase Orders")
Set qdfAction = db.OpenRecordset("Purchase Orders", strSQL)
qdfAction.Execute dbFailOnError
rec.Close
Set rec = Nothing
Me.Requery
What am I doing wrong??????