?
Solved

How have form "remember" data entry for certain fields for subsequent record entry

Posted on 2012-03-19
4
Medium Priority
?
454 Views
Last Modified: 2012-03-19
Is there a way to have certain fields on a form "remember" the previous data entry from the previous record entered?

In other words, I have a form that is used to create records in a table.  But some of the fields on the form I want to have repeat the prior entry so the user doesn't have to key it again.

Can this be done?

--Steve
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
4 Comments
 
LVL 44

Expert Comment

by:GRayL
ID: 37739508
In the new area, type ctl+' (apostrophe) to copy the data in the previous record into the current record.
0
 
LVL 48

Accepted Solution

by:
Dale Fye earned 2000 total points
ID: 37739511
If you are entering records consecutively, without closing the form, you could use the AfterUpdate event of those controls, something like:

Private Sub txt_Field1_AfterUpdate

    me.txt_Field1.DefaultValue = me.txt_Field1

End Sub
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 37739580
Be careful with the term "Previous Record"

Unless you app is somewhat secured, a user can easily "resort" the list, thus changing what was once the "Previous Record"

In any event, you can also use the button Wizard to Create code to "Copy" the current record and create a new record.

    DoCmd.RunCommand acCmdSelectRecord
    DoCmd.RunCommand acCmdCopy
    DoCmd.RunCommand acCmdRecordsGoToNew
    DoCmd.RunCommand acCmdSelectRecord
    DoCmd.RunCommand acCmdPaste

Then clear out any field you did not want copied with something like this:
me.txtSomeValue1=""
me.txtSomeValue3=""


JeffCoachman
0
 
LVL 42

Expert Comment

by:dqmq
ID: 37739610
There are many ways to accomplish that offering you different levels of control over what "previous" means and under what conditions you default a record to that value.

Let me propose one, which is fairly simple and gives you a fair amount of flexibilty:

In the form's after update event, save the old value(s) like this:

me.YourControlName.Tag = Me.YourControlName.Value


In the form's on current event, default to the saved value like this:
if me.newrecord and isnull(me.YourControlName.Value) then me.YourControlName.Value = me.YourControlName.Tag


ps.  If you don't like using the .tag property for that purpose, you can just as well use invisible fields on the form, variables that are global to the form, or other forms of session-scoped storage.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
Suggested Courses

777 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