Create SQL table from Excel VBA

angil0126

New Member
Joined
Apr 9, 2018
Messages
8
Hello -

I have the following table in Excel

[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]SLCo[/TD]
[TD]SL[/TD]
[TD]CompCode[/TD]
[TD]APRef[/TD]
[TD]Amount[/TD]
[TD]Release[/TD]
[/TR]
[TR]
[TD]101[/TD]
[TD]19[/TD]
[TD]CM[/TD]
[TD]967[/TD]
[TD]5000[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]101[/TD]
[TD]19001-01P[/TD]
[TD]CM[/TD]
[TD]19001-0719[/TD]
[TD]10500[/TD]
[TD]X[/TD]
[/TR]
[TR]
[TD]101[/TD]
[TD]123546-A[/TD]
[TD]CM[/TD]
[TD]123658-1[/TD]
[TD]15000[/TD]
[TD]X[/TD]
[/TR]
[TR]
[TD]101[/TD]
[TD]56875-4[/TD]
[TD]CM[/TD]
[TD]9856-7A[/TD]
[TD]7500[/TD]
[TD]X[/TD]
[/TR]
[TR]
[TD]101[/TD]
[TD]32587-4[/TD]
[TD]CM[/TD]
[TD]5647-8[/TD]
[TD]21500[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

Using VBA on a button, I'd like to do the following:

- Execute a Stored Procedure in SQL database that creates a temp table with columns SLCo, SL, CompCode, APRef from the data above ONLY where Release = X
- Updates existing table based on matching records found in temp table
- Delete temp table

I can create the table (I think), but am at a loss as to how to populate with the records only where Release = X

Any help would be greatly appreciated!
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
You will need to use an SQL statement when creating the table.


Code:
Select * from TABLE_NAME where Release like 'X'
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,215
Members
452,618
Latest member
Tam84

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