PDA

Click to See Complete Forum and Search --> : ADO AddNew method


Poornima
Feb 3rd, 2000, 02:34 AM
Hi,
I'm trying to use the AddNew method of ADO recordset object. In my table I have an Identity(Auto number) field which I need to access before updating as another field is a string format of the same number. My recordset properties are:
CursorLocation = adUseClient
Cursor Type = adOpenDynamic
Locktype = adLockOptimistic
Other details
DB - SQL Server 7.0
ADO 2.1

I'm unable to access the Identity field even after the update.
With DAO Addnew method I can access the Auto number field as soon as I say AddNew.


Any help is appreciated
Thanks
Poornima

sushant
Feb 3rd, 2000, 01:48 PM
1. If your table has any other primary key fields apart from the auto number field, then you have a to fire a query to get the value if the autnumbered column.

2. If it not, then you can get the value of the auto numbered field by firing the followinf query

SELECT MAX(aAutoNumCol) FROM myTable

Hope it will solve your problem