I try this but it keeps returning zero !
Dim newid As Long
CurrentProject.Connection.Execute "INSERT INTO [ORDER] (ORD_P_ID,
ORD_CREATION_DATE) VALUES ('4004', CONVERT(DATETIME,'" & Year(Date) & "-" &
Month(Date) & "-" & Day(Date) & " 00:00:00', 102)); select @@identity as
'newID'"
Me.Requery
MsgBox newid >> returns 0
Msgbox DMax("ORD_ID","[ORDER]") >> returns the new id
My question stays: is it possible to return the newid into a VB-variable
directly?
Filip
"Guinness Mann" <GM***@dublin.com> wrote in message
news:MP************************@news.newsguy.com.. .
In article <E%*********************@phobos.telenet-ops.be>,
be***********@pandora.be says... There was no semicolon in the code!I followed an example in a Book!
Where should i put the semicolon? > objConn.Execute "INSERT INTO CONTACT (CNT_PHONE) VALUES
('012345678') > SELECT @@IDENTITY as 'NewID'"
Between statements, I believe. Where the "Go" would go. Otherwise you
must send two commands.
-- Rick