Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
|
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 April 27th, 2007, 04:12 PM
Authorized User
 
Join Date: Apr 2007
Posts: 56
Thanks: 0
Thanked 0 Times in 0 Posts
Default Delete a record row, not just the record.

If I am evaluating a current record in a table, is it possible to delete the entire row in which it exists in.

Example:
Do While Not rstTempWip.BOF
            If rstTempWip("Status").Value <> "Completed" Then
    'HERE IS WHERE I JUST WANT TO DELETE THE ENTER RECORD ROW since the entire line item is considered completed.

           With rstTempWip
                .Edit
                .Delete
                .Update
            End With
            End If
        rstTempWip.MovePrevious
        Loop

 
Old April 30th, 2007, 06:29 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

I would do this with a Delete query. Create the delete query and in the column with the Completed value, enter the value that should condition the delete. This will delete the entire record.

Then just do this on your code:

DoCmd.SetWarnings False
DoCmd.OpenQuery "qryDELETEComplete"
DoCmd.SetWarnings True

Did that help?



mmcdonal





Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I delete a record from a subform captainlove SQL Server ASP 1 April 29th, 2008 12:01 AM
delete record error -Dman100- Classic ASP Professional 2 September 11th, 2004 07:57 PM
Trying to delete a record... Can't do it... lguzman Access VBA 11 August 13th, 2004 12:41 PM
Can't delete record Trojan_uk SQL Server 2000 3 November 27th, 2003 01:03 PM
Delete record but how? scifo Beginning PHP 3 August 1st, 2003 12:14 PM





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