Insert Records into SQL Server DB from UserForm ListBox

bhalbach

Board Regular
Joined
Mar 15, 2018
Messages
221
Office Version
  1. 2016
Platform
  1. Windows
How can I insert all items in a multi column listbox on a excel Userform into a SQL Server DB table?
Each line of the listbox is 1 record for the table in sql server db. The listbox has 7 columns.

I am assuming that I need to loop through the listbox so that each row of the listbox is inserted as a record into the table in the DB

I have the connection to the DB sorted out and can insert to the DB from a textbox but not from a listbox.

Please help, I have been googling for 2 days and cannot find a solution.
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
How can I insert all items in a multi column listbox on a excel Userform into a SQL Server DB table?
Each line of the listbox is 1 record for the table in sql server db. The listbox has 7 columns.

I am assuming that I need to loop through the listbox so that each row of the listbox is inserted as a record into the table in the DB

I have the connection to the DB sorted out and can insert to the DB from a textbox but not from a listbox.

Please help, I have been googling for 2 days and cannot find a solution.

RESOLVED.
 
Upvote 0

Forum statistics

Threads
1,215,742
Messages
6,126,611
Members
449,321
Latest member
syzer

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top