Solved

Access 2010,  Save info to varaible just before new record has been written

Posted on 2013-02-04
2
288 Views
Last Modified: 2013-02-04
Hi

I am using access 2010

I would like to record the value of a data field just before a NEW record has been saved.
I tried the code below, but....


public strLastDataEntry

Private Sub Form_AfterUpdate()
     If Me.NewRecord = True Then
             strLastDataEntry = [myfield]
     End if
End sub
0
Comment
Question by:peispud
2 Comments
 
LVL 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 500 total points
ID: 38853402
Move your code to the Before Update event. By the time you hit AfterUpdate, Me.NewRecord would not be True.
0
 

Author Closing Comment

by:peispud
ID: 38853423
Perfect and timely.  Thank you.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
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…

911 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now