Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: David Mustakim
  Where is David Mustakim?
 Jakarta
 Indonesia
 David Mustakim
 To: Vilhelm-Ion Praisach
  Where is Vilhelm-Ion Praisach?
 Resita
 Romania
 Vilhelm-Ion Praisach
 Tags
Subject: RE: Get the last id in MS access
Thread ID: 393661 Message ID: 393760 # Views: 33 # Ratings: 0
Version: Visual FoxPro 9 Category: Windows 7 and VFP
Date: Monday, December 23, 2013 5:52:25 AM         
   


> >
> >
> >
> > I don't use Access but elaboration would be much appreciated Vilhelm - TIA
> >
> > David
>
> Neither do I, but I googled and I found this (it's tested) :
>
>
Sub aa()
> Dim query As String
>   ' MyTable has an autoinc primary field
>   Dim newRow As Long
>   Dim db As DAO.Database
> 
>   query = "INSERT INTO MyTable (MyField) VALUES ('New entry');"
>   Set db = CurrentDb
>   db.Execute (query)
>   newRow = db.OpenRecordset("SELECT @@IDENTITY;")(0)
>   
>   MsgBox (newRow) ' verify
>   
>   Set db = Nothing
> 
> End Sub

>
> My respects


I c.. thx

Regards,
David

ENTIRE THREAD

Get the last id in MS access Posted by JAVA 4ever @ 12/21/2013 6:39:54 AM
RE: Get the last id in MS access Posted by Ali Koumaiha @ 12/21/2013 3:40:39 PM
RE: Get the last id in MS access Posted by Vilhelm-Ion Praisach @ 12/22/2013 8:56:09 PM
RE: Get the last id in MS access Posted by David Mustakim @ 12/22/2013 9:05:13 PM
RE: Get the last id in MS access Posted by Glen Villar @ 12/23/2013 2:11:20 AM
RE: Get the last id in MS access Posted by Vilhelm-Ion Praisach @ 12/23/2013 5:46:22 AM
RE: Get the last id in MS access Posted by David Mustakim @ 12/23/2013 5:52:25 AM