Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

mysql to excel via VB

Status
Not open for further replies.

snootalope

IS-IT--Management
Jun 28, 2001
1,706
US
I'm stumped, so i hope an expert can help me out here. I got some vb in an excel 2007 spreadsheet that accesses a mysql database just fine. I've got it to where excel can dump info to the db, but now I'm trying to pull it. So, here's what I got (besides all the connection info):

This info dumps a figure into a table in mysql. That table has it's first column set as an incrementing number. The data dumps just fine to the db in the row it's suppose to and gets a number assigned. My objective here is once the below script runs, it then has to get the number it was assigned and return it to excel and place it in a certain cell. Can anyone point me in the right direction, I'm about googled out..
--------------------------------------------
With Worksheets("sheet1")
For i = 5 To 6
If .Cells(i, 3) = "" Then Exit For
sqlstr = "INSERT INTO " & table2 & " SET " _
& field6 & " = '" & .Cells(i, 3) & "'"

conn.Execute sqlstr
Next i
End With
--------------------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top