Solved

How delete only new records in a continuous form

Posted on 2016-11-16
6
61 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 50

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 50

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
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
LVL 37

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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

729 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