Is there a way to retrieve the id from the record that was just inserted to DB? That is, I insert some values into an access DB and the record automatically creates an ID.
The ID that is created (autonumber) is needed when I add new records to other tables with this ID as foreign key.
I doesn't seem like a sql INSERT Query returns something, so just after Inserting the record, I try to do a SELECT query with the same conditions. Among others I insert the current date:
INSERT INTO Responses(Customer, FormId, DateSubmitted) VALUES ('" & Session("Customer"
& "'," & Session("FormId"
& ",'" & today & "')"
I then tried to SELECT
"SELECT ResponseId FROM Responses WHERE DateSubmitted='" & today "'"
But here I get a datatype missmatch!!
So, is there another way to retrieve the ID that was just generated from the INSERT statement or do I have to convert the 'today' to another format when using it as condition in a select?
Hope this wasn't too complicated.
Thanks for your help guys
The ID that is created (autonumber) is needed when I add new records to other tables with this ID as foreign key.
I doesn't seem like a sql INSERT Query returns something, so just after Inserting the record, I try to do a SELECT query with the same conditions. Among others I insert the current date:
INSERT INTO Responses(Customer, FormId, DateSubmitted) VALUES ('" & Session("Customer"
I then tried to SELECT
"SELECT ResponseId FROM Responses WHERE DateSubmitted='" & today "'"
But here I get a datatype missmatch!!
So, is there another way to retrieve the ID that was just generated from the INSERT statement or do I have to convert the 'today' to another format when using it as condition in a select?
Hope this wasn't too complicated.
Thanks for your help guys