SQL joins in VBA

tiredofit

Well-known Member
Joined
Apr 11, 2013
Messages
1,834
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Further to this thread:

Code:
https://www.mrexcel.com/board/threads/sql-query-in-excel.1160445/#post-5631185

my data now is entirely on Sheet1.

A1 contains Fruit, B1 contains Store, C1 contains Fruit and D1 contains Store.

This query doesn't work:

Code:
strSQL = "SELECT [Sheet1$A1], [Sheet1$B1], [Sheet1$D1] " & _
             "FROM [Sheet1$A1:B6] INNER JOIN [Sheet1$C1:D4] ON [Sheet1$A1] = [Sheet1$C1]"

with an error message:

Code:
Join expression not supported

Can someone tell me what is wrong?

Thanks
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.

Forum statistics

Threads
1,214,957
Messages
6,122,472
Members
449,087
Latest member
RExcelSearch

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