icemonster
Registered User.
- Local time
- Today, 00:16
- Joined
- Jan 30, 2010
- Messages
- 502
so i found this in the internet by allen brown, it works well but i need help adjusting it when using it with appended tables because i keep getting a 0 in in the result.
any ideas?
Code:
Function ShowIdentity() As Variant
Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = DBEngine(0)(0)
db.Execute "INSERT INTO tbl2 ( ID ) SELECT tbl1.ID FROM tbl1;"
Set rs = db.OpenRecordset("SELECT @@IDENTITY AS LastID;")
ShowIdentity = rs!LastID
rs.Close
Set rs = Nothing
Set db = Nothing
End Function
any ideas?