Solved

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

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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
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.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

691 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