Wrox Programmer Forums
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 22nd, 2007, 01:35 PM
Friend of Wrox
 
Join Date: May 2006
Posts: 144
Thanks: 0
Thanked 0 Times in 0 Posts
Default delete null records

Hi,
I'm trying to use this line of code to delete all the null records in a table. Current is the only field in the table. It runs without an error, but it doesn't appear to do anything. What's wrong with this?

Code:
DoCmd.RunSQL (" DELETE * FROM tbl_current_reserve WHERE tbl_current_reserve.[CURRENT] = NULL ")
Thanks,
Dave

 
Old January 22nd, 2007, 04:59 PM
Friend of Wrox
 
Join Date: May 2006
Posts: 144
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Nevermind,

"is Null" instead of "= Null"

 
Old January 23rd, 2007, 08:31 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

The reason is that nothing = Null, not even Null. So it can never be used for a condition, as you have found out.


mmcdonal
 
Old January 23rd, 2007, 04:48 PM
Friend of Wrox
 
Join Date: May 2006
Posts: 144
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quick question. just because I'm curious and don't know.
Why does this code work for setting something equal to Null?

Code:
iMid = Mid(sField, 7, 2)
    If iMid >= iSkip Then
        rsCur.Edit
        rsCur![Current] = Null
        rsCur.Update
    End If







Similar Threads
Thread Thread Starter Forum Replies Last Post
limiting/hiding records w/null values louisvillelivin Crystal Reports 0 February 5th, 2007 10:43 AM
Delete Duplicate Records prasanta2expert SQL Server 2000 9 December 15th, 2006 10:44 PM
update/delete fails when row contains null values davej ASP.NET 2.0 Basics 2 December 6th, 2006 03:47 PM
Edit or Delete records tsimsha Classic ASP Basics 6 October 30th, 2004 03:26 AM
Hide NULL records chiraagb ADO.NET 2 May 29th, 2004 12:28 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.