Alex:
Thanks, but that didn't work either. If I change the DELETE statement to
the following, the code works:
db.Execute "DELETE FROM [MasterData] WHERE [MasterData].[Name] = 'ABC
Company'"
But where the Name field is null, the code that has been suggested does
not work.
Here is my subroutine:
'CANCEL BUTTON
Private Sub CancelButton_Click()
Dim db As DAO.Database
On Error Resume Next
If OriginalCompanyName = "" Then
Set db = CurrentDb
db.Execute "DELETE FROM [MasterData] WHERE [MasterData].[Name] Is
Null"
End If
End Sub
Any further suggestions?
Thanks,
BobV
Alex Dybenko said:
Also try to run:
db.Execute "DELETE FROM [MasterData] WHERE [MasterData].[Name] =
""",dbFailOnError
in this case you will get a runtime error if data can not be deleted for
some reason
--
Alex Dybenko (MVP)
http://alexdyb.blogspot.com
http://www.PointLtd.com
BobV said:
Tom:
I tried your suggestion, but it still doesn't work -- the record is not
deleted. Any other suggestions?
Thanks,
BobV
Group:
I want to write code that will delete a record from the table named
MasterData if the Name field is blank. I have been trying the
following code but it doesn't work. What am I missing?
db.Execute "DELETE FROM [MasterData] WHERE [MasterData].[Name] = """
Try this:
db.Execute "DELETE FROM [MasterData] WHERE [MasterData].[Name] Is Null"
Strings that haven't had a value assigned yet are Null rather than ""
Tom Lake