Solved

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

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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
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…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.

840 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