Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
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.
Reply With Quote
  #2 (permalink)  
Old April 9th, 2010, 08:33 AM
Friend of Wrox
Points: 4,007, Level: 26
Points: 4,007, Level: 26 Points: 4,007, Level: 26 Points: 4,007, Level: 26
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jun 2003
Location: Lansing, Michigan, USA.
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

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
Reply With Quote
The Following User Says Thank You to SerranoG For This Useful Post:
Disgruntled (April 16th, 2010)
  #3 (permalink)  
Old April 16th, 2010, 05:28 PM
Authorized User
Join Date: Mar 2010
Posts: 10
Thanks: 1
Thanked 0 Times in 0 Posts

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

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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

All times are GMT -4. The time now is 04:37 AM.

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