Null value in AUTONUMBER field after MyRS.RECSET.AddNew 
Author Message
 Null value in AUTONUMBER field after MyRS.RECSET.AddNew

How can I receive AUTONUMBER value from MDB table
immediate after MyRS.RECSET.AddNew
command.   In MS SQL following code works correctly:
…
With MyRS.RecSet
 .AddNew
 .Update
 Debug.Print ![MenuTreeID]
End With
But for MDB table Debug.Print ![MenuTreeID] returns “0”.


Sat, 14 Aug 2004 16:02:21 GMT  
 Null value in AUTONUMBER field after MyRS.RECSET.AddNew
Hi,

If you are using Access 2000, then you can get new

links to see how to do that

http://www.able-consulting.com/ADO_Faq.htm#Q9

http://support.microsoft.com/directory/article.asp?
ID=KB;EN-US;Q195910&LN=EN-US&SD=msdn&FR=0&qry=HOWTO%20work%
20with%20autonumber%20in%
20ADO&rnk=1&src=DHCS_MSPSS_msdn_SRCH&SPR=MSALL

Val

Quote:
>-----Original Message-----
>How can I receive AUTONUMBER value from MDB table
>immediate after MyRS.RECSET.AddNew
>command.   In MS SQL following code works correctly:
>
>With MyRS.RecSet
> .AddNew
> .Update
> Debug.Print ![MenuTreeID]
>End With
>But for MDB table Debug.Print ![MenuTreeID] returns 0.

>.



Sat, 14 Aug 2004 20:27:31 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. adodb connection to excel: recordset.fields(i).value=null for fields with numeric value

2. adodb connection to excel: recordset.fields(i).value=null for fields with numeric value

3. adodb connection to excel: recordset.fields(i).value=null for fields with numeric value

4. AddNew NOT automatically returning AutoNumber value?!?

5. doesn't recognize Null value from a field value

6. addnew method and PubID field being set to null

7. Strange recset.addnew ILLEGAL FUNC CALL message...

8. Inserting values into an autonumber field

9. Field Type AutoNumber and pre-setting value

10. Second Post: Field Type AutoNumber and pre-setting Start value

11. Why is it unable to retrieve the value of an autonumber field

12. Determining autonumber field value

 

 
Powered by phpBB® Forum Software