How to delete an entire line from a table using a delete query

JeffreyDavid

Registered User.
Local time
Today, 02:19
Joined
Dec 23, 2003
Messages
63
:confused:
I have a form and subform, if the form is opened and closed without doing anything, it creates a blank line in the table. Given enough time, that table will be a mess. I want to create a delete query based on,
If Product is Null
If Model is Null
If Description is Null
If Type is null
I want to delete the entire line if those fields are null.
How would one go about acomplishing this?
 
How about :

Code:
DELETE * FROM MyTable WHERE
Nz([Product] & [Model] & [Description] & [Type]) = ""

However, there should be a way to prevent a blank record from being inserted in the first place. Perhaps one of the experts here can help you figure that out.
 
A common technique is to place validation code in the form's Before Update Event...

Code:
If Isnull(me.ThisTextbox) or thisTextBox = "" Then
	Cancel = True 'Don't save the record.
             Msgbox "Please fill out..."
End if

Regards,
Tim
 

Users who are viewing this thread

Back
Top Bottom