MySQL Forums
Forum List  »  MySQL for Excel

last_insert_id and VBA Excel
Posted by: Richard Pupko
Date: June 18, 2012 02:51PM

I need to insert a record into a MySql table. It is based upon a row in an Excel spreadsheet.

I then need to get the PK of the record I just inserted and put that value into a cell on the spreadsheet.

So my SQL statements are something like

INSERT INTO myTable (field1,field2) VALUES (value1,value2);
SELECT last_insert_id;

Could somebody please provide some VBA code that could be used to execute the second statement and store it someplace that I can use with
CELLS(row,column).value = the new PK.

Thanks to all...........Rich

Options: ReplyQuote

Written By
last_insert_id and VBA Excel
June 18, 2012 02:51PM
June 18, 2012 04:46PM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.