Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How delete only new records in a continuous form

Posted on 2016-11-16
6
Medium Priority
?
73 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 52

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 52

Accepted Solution

by:
Gustav Brock earned 2000 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
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 
LVL 39

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 31

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

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

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

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

609 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