Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delete with WHERE Clause. 2

Status
Not open for further replies.

serino

Programmer
Feb 13, 2003
107
US
Need some help here. Why is this not working?

DELETE FROM HR_021_Isolates_Records_For_Anniversary_Reset_Table WHERE HR_021_Isolates_Records_For_Anniversary_Reset_Table.Code="Unpaid" AND HR_021_Isolates_Records_For_Anniversary_Reset_Table.UTimeTaken=Null AND HR_021_Isolates_Records_For_Anniversary_Reset_Table.OFTimeTaken=Null;
 
Jet SQL requires DELETE * FROM instead of DELETE FROM that works for most other versions of SQL.
 
In addition to Axworthy’s reply, you shouldn’t use "=Null". Always use "is Null".

Code:
HR_021_Isolates_Records_For_Anniversary_Reset_Table.UTimeTaken is Null AND
HR_021_Isolates_Records_For_Anniversary_Reset_Table.OFTimeTaken is Null;

Duane
Minnesota
Hook'D on Access
MS Access MVP 2001-2016
 
To see the record(s) you want to Delete, it is beneficial to Select them first just to make sure you will delete record(s) you want:
If you do:
[tt][blue]
SELECT[/blue] * FROM HR_021_Isolates_Records_For_Anniversary_Reset_Table
WHERE Code = "Unpaid"
AND UTimeTaken Is Null
AND OFTimeTaken Is Null;
[/tt]
and if that looks OK, then just change [blue]Select[/blue] to [red]Delete[/red]

---- Andy

"Hmm...they have the internet on computers now"--Homer Simpson
 
Thanks you both. I must of copied and pasted the code incorrectly I did have DELETE * in there but fixing the null did the trick.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top