Solved

How delete only new records in a continuous form

Posted on 2016-11-16
6
37 Views
Last Modified: 2016-11-16
I have a continuous form that displays existing records but also allows the user to add new records.  My question is this, via a command button, if the user decides they did not want to add the new records they keyed in, can those new records be deleted and keep the existing records and if so, what would that code look like?
0
Comment
Question by:SteveL13
6 Comments
 
LVL 49

Expert Comment

by:Gustav Brock
ID: 41889636
Yes. Just mark the records (the record selector at far left) and press Delete.

/gustav
0
 

Author Comment

by:SteveL13
ID: 41889641
Yes, I know it can be done that way.  But I need to make it easy for a novice via a command button.
0
 
LVL 49

Accepted Solution

by:
Gustav Brock earned 500 total points
ID: 41889662
You can run this code if you can define the condition for a "new" record:

Dim rs As DAO.Recordset

Set rs = Me.RecordsetClone
While Not rs.EOF
    If (<condition for a "new" record>) = True Then
        rs.Delete
    End If
    rs.MoveNext
Wend
Set rs = Nothing

Open in new window

/gustav
0
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
LVL 35

Expert Comment

by:PatHartman
ID: 41889795
What is "new"?  Added today, added in the last hour, added in the last 5 minutes, added by this user?

At a minimum you need to add DateAdded and AddedBy fields to the table.  Then you would use the specific timing interval you choose and the Added by to choose which records to delete.  Although forcing the user to choose individual records and then validating the timing and person is far safer.
0
 
LVL 30

Expert Comment

by:hnasr
ID: 41889841
This feature is similar to record activation for software or accounts.

You may add a field with default value, pending activation.
A button to accept the records, by updating pending activation to active.
A button to delete pending activation.

You may filter deletion for a period of time.
0
 

Author Closing Comment

by:SteveL13
ID: 41890206
I added a "Delete Record" checkbox to the table and the form.
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question