VBA How to find last insert id?

Posted by Muiter on Stack Overflow See other posts from Stack Overflow or by Muiter
Published on 2010-03-21T19:22:40Z Indexed on 2010/03/21 19:31 UTC
Read the original article Hit count: 300

Filed under:
|
|
|

I have this code:

With shtControleblad
    Dim strsql_basis As String
        strsql_basis = "INSERT INTO is_calculatie (offerte_id) VALUES ('" & Sheets("controleblad").Range("D1").Value & "')"

        rs.Open strsql_basis, oConn, adOpenDynamic, adLockOptimistic

        Dim last_id As String
        last_id = "select last_insert_id()"
End With

The string last_id is not filled. What is wrong? I need to find te last_insert_id so I can use it in an other query.

© Stack Overflow or respective owner

Related posts about vba

Related posts about mysql