I am receiving an error message about a (missing operator) in query expression 'PK_Audience =':
Private Sub DeletePublicationRecord()
delPK_PubData = ComboPubName
[highlight]CurrentDb.Execute "DELETE FROM Tbl_Audience WHERE
PK_Audience = " & DLookup("FK_Audience", "Tbl_PubData", "PK_PubData = " & delPK_PubData) & ";" [/highlight]
CurrentDb.Execute "DELETE FROM Tbl_Distribution WHERE PK_Distribution = " & DLookup("FK_Distribution", "Tbl_PubData", "PK_PubData = " & delPK_PubData) & ";"
CurrentDb.Execute "DELETE FROM Tbl_Index WHERE PK_Index = " & DLookup("FK_Index", "Tbl_PubData", "PK_PubData = " & delPK_PubData) & ";"
CurrentDb.Execute "DELETE FROM Tbl_Lifecycle WHERE PK_Lifecycle = " & DLookup("FK_Lifecycle", "Tbl_PubData", "PK_PubData = " & delPK_PubData) & ";"
CurrentDb.Execute "DELETE FROM Tbl_Print WHERE PK_Print = " & DLookup("FK_Print", "Tbl_PubData", "PK_PubData = " & delPK_PubData) & ";"
CurrentDb.Execute "DELETE FROM Tbl_ProdLoc WHERE PK_ProdLoc = " & DLookup("FK_ProdLoc", "Tbl_PubData", "PK_PubData = " & delPK_PubData) & ";"
CurrentDb.Execute "DELETE FROM Tbl_PubData WHERE PK_PubData = " & delPK_PubData & ";"
CurrentDb.Execute "DELETE FROM Tbl_PubName WHERE FK_PubData = " & delPK_PubData & ";"
CurrentDb.Execute "DELETE FROM Tbl_PubWeb WHERE PK_PubWeb = " & DLookup("FK_PubWeb", "Tbl_PubData", "PK_PubData = " & delPK_PubData) & ";"
CurrentDb.Execute "DELETE FROM Tbl_SourceType WHERE PK_SourceType = " & DLookup("FK_SourceType", "Tbl_PubData", "PK_PubData = " & delPK_PubData) & ";"
MsgBox "Publication deleted.", vbOKOnly + vbInformation, "Delete Publication"
End Sub
I am trying to delete a publication and able to get to the final step of deleting the pub from the database and then I get the error message. When I hit debug it goes to the highlighted code.
Any help would be appreciated. Thanks!!!!!
Private Sub DeletePublicationRecord()
delPK_PubData = ComboPubName
[highlight]CurrentDb.Execute "DELETE FROM Tbl_Audience WHERE
PK_Audience = " & DLookup("FK_Audience", "Tbl_PubData", "PK_PubData = " & delPK_PubData) & ";" [/highlight]
CurrentDb.Execute "DELETE FROM Tbl_Distribution WHERE PK_Distribution = " & DLookup("FK_Distribution", "Tbl_PubData", "PK_PubData = " & delPK_PubData) & ";"
CurrentDb.Execute "DELETE FROM Tbl_Index WHERE PK_Index = " & DLookup("FK_Index", "Tbl_PubData", "PK_PubData = " & delPK_PubData) & ";"
CurrentDb.Execute "DELETE FROM Tbl_Lifecycle WHERE PK_Lifecycle = " & DLookup("FK_Lifecycle", "Tbl_PubData", "PK_PubData = " & delPK_PubData) & ";"
CurrentDb.Execute "DELETE FROM Tbl_Print WHERE PK_Print = " & DLookup("FK_Print", "Tbl_PubData", "PK_PubData = " & delPK_PubData) & ";"
CurrentDb.Execute "DELETE FROM Tbl_ProdLoc WHERE PK_ProdLoc = " & DLookup("FK_ProdLoc", "Tbl_PubData", "PK_PubData = " & delPK_PubData) & ";"
CurrentDb.Execute "DELETE FROM Tbl_PubData WHERE PK_PubData = " & delPK_PubData & ";"
CurrentDb.Execute "DELETE FROM Tbl_PubName WHERE FK_PubData = " & delPK_PubData & ";"
CurrentDb.Execute "DELETE FROM Tbl_PubWeb WHERE PK_PubWeb = " & DLookup("FK_PubWeb", "Tbl_PubData", "PK_PubData = " & delPK_PubData) & ";"
CurrentDb.Execute "DELETE FROM Tbl_SourceType WHERE PK_SourceType = " & DLookup("FK_SourceType", "Tbl_PubData", "PK_PubData = " & delPK_PubData) & ";"
MsgBox "Publication deleted.", vbOKOnly + vbInformation, "Delete Publication"
End Sub
I am trying to delete a publication and able to get to the final step of deleting the pub from the database and then I get the error message. When I hit debug it goes to the highlighted code.
Any help would be appreciated. Thanks!!!!!