
Signature
Alex Dybenko (MVP)
http://alexdyb.blogspot.com
http://www.PointLtd.com
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
> Also try to run:
> db.Execute "DELETE FROM [MasterData] WHERE [MasterData].[Name] =
[quoted text clipped - 26 lines]
>>>
>>> Tom Lake
Duane Hookom - 17 Dec 2005 21:39 GMT
What happens when you paste the sql into a new query and attempt to run it?
Also, do you expect the value of OrginalCompanyName to be a zero length
string or could it be Null (not the same thing). Have you tried to step
through the code? How about adding a Msgbox after the If OriginalCompanyName
= ""...?

Signature
Duane Hookom
MS Access MVP
> Alex:
>
[quoted text clipped - 55 lines]
>>>>
>>>> Tom Lake
John Vinson - 18 Dec 2005 03:37 GMT
> Alex:
>
[quoted text clipped - 3 lines]
> db.Execute "DELETE FROM [MasterData] WHERE [MasterData].[Name] = 'ABC
> Company'"
The DELETE statement requires you delete *SOMETHING* - a fieldname or (more
commonly) the * pseudofield. Try
db.Execute "DELETE * FROM [MasterData] WHERE [MasterData].[Name] =
'ABC Company'"
or (more specifically for your example)
db.Execute "DELETE * FROM [MasterData] WHERE [MasterData].[Name] IS NULL"
John W. Vinson/MVP