Solved

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

Posted on 2013-02-04
2
295 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
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.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

789 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