How do I gett the value of autoincrement field after an .AddNew/.Update 
Author Message
 How do I gett the value of autoincrement field after an .AddNew/.Update

Hi All!

I've got a 2 form datbase inquiry/change/add/delete application

Inquiry and delete take place on the main from with an ADODC control
attached to an
Access database (NWND.MDB) using Jet4.0.

Updates/adds take place on a second form.  The .DataSource and .DataField
properties on a series of text boxes is set at run-time in the FormLoad
procedure.

When I add a record using an .AddNew/.Update series of method calls, when
I return to the main from, the Auto-Increment field display a zero in the
associated
databound textbox.

If I then try to delete the added record, I get a runtime error saying I
can't delete the
record as some of the data has changed.

If I exit the program and restart, I can see that the Auto-Increment field
has actually
been updated correctly and I can then delete the record with ease.

I can I force my application to display the proper value in the
autoincrement field
immediately upon adding the record?  Ideally, I would like to retreive the
incremented
value immediately after the .Update method call.

I know this has something to do with Cursors and Lock modes, but my VB
teacher
hasn't covered this at all and I'm having trouble making sense out of the
explaination
in the book.

A clue would be vastly appreciated.

adTHANKSvance!

Simeon



Sat, 27 Aug 2005 02:01:02 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Counter Fields - value assigned on Addnew not Update?

2. not to auto update while doing addnew

3. Getting the value of an autoincrement or identity field during an sql insert

4. PRB: Autoincrement field swapping values!

5. How to reset autoincrement field value

6. Resolving autoincrement fields next value

7. Change autoincrement field value.

8. Changing seed value for AutoIncrement Field

9. Getting the value of an autoincrement or identity field during an sql insert

10. Access counter field value during AddNew

11. AddNew/Update command & field searches

12. Access counter field value during AddNew

 

 
Powered by phpBB® Forum Software