Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 22nd, 2010, 06:57 PM
Authorized User
 
Join Date: Mar 2010
Posts: 10
Thanks: 1
Thanked 0 Times in 0 Posts
Default updating Record & Form at same time

I have a form that is bound to a table. On the form is a combo box that controls record selection. I also have a button that can add a new record, and a text box that shows the current record number.

I am not showing the navigation buttons or record selector.

What I want to do is:

1) when I add the new record, allow the combo box to accept value (that is not in the list) - i'm trying the event "NotInList( )"

Possibly requery the combo box.

2) when i add the new record, set the text box to display the new record number - does this automatically make the record dirty? (I don't want it to be considered dirty until other fields (like the combo box) have accepted new values.

thanks for the help.
 
Old April 9th, 2010, 08:33 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

Is the record number an autonumber or is it a user-defined record number?

If an autonumber, it will not appear, nor will the record become dirty, until you start typing values in the other fields. If this is the case, one wonders why you are showing record numbers. Autonumbers are not suppsed to be seen by users and make no sense to anyone. They're used ONLY by the computer to relate primary and foreign keys in various tables to each other.

If your record number is user-defined and "makes sense" to the user, the second you compile it and place it into the record number textbox, your record will be considered dirty. To avoid that, don't actually set the record number. Iinstead, compile its value like you normally do, but set the textbox's DEFAULT VALUE equal to the new record number. The default value will show, but because you didn't set the actual value of the textbox (just its default), the record will not be dirty. When you start typing in another field, the record number's default will be automatically entered into the field for you and THEN the record will become dirty as you type somewhere else.
__________________
Greg Serrano
Michigan Dept. of Environmental Quality
Air Quality Division
The Following User Says Thank You to SerranoG For This Useful Post:
Disgruntled (April 16th, 2010)
 
Old April 16th, 2010, 05:28 PM
Authorized User
 
Join Date: Mar 2010
Posts: 10
Thanks: 1
Thanked 0 Times in 0 Posts
Default

I will look into this solution because I have tried several contortions of BeforeUpdate/AfterUpdate....





Similar Threads
Thread Thread Starter Forum Replies Last Post
time zone & day light time rajn ASP.NET 1.0 and 1.1 Professional 0 August 7th, 2007 05:02 PM
Problem in Updating a record using a form shrisangeeta Classic ASP Basics 2 August 30th, 2006 11:39 PM
updating record stoneman Access 1 July 5th, 2005 09:12 AM
Error updating record in bounded form method Access 0 June 19th, 2005 05:31 PM
Record not updating Tangerine ASP.NET 1.x and 2.0 Application Design 3 March 24th, 2004 12:00 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.