Solved

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

Posted on 2012-03-19
4
451 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 47

Accepted Solution

by:
Dale Fye (Access MVP) earned 500 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
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…
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…

726 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