Error 1004 when performing LEFT JOIN in SQL query in Excel VBA

dave31

New Member
Joined
Sep 15, 2016
Messages
1
Hi,

I usually perform only simple SQL queries inside Excel VBA. Today I've unsuccessfully tried to add a LEFT JOIN to one of the Excel queries. It seems that when I try to add table aliases the error occurs. For instance, this works:

SELECT table.field_ID As 'ID' FROM database.table

but the following doesn't work:

SELECT t.field_ID As 'ID' FROM database.table As t

Ultimately I'd like a query that resembles the following structure:

SELECT t1.field, t2.field FROM database.table LEFT JOIN lookup As t1 ON t1.id = database.id LEFT JOIN lookup As t2 ON t2.id = database.id

Instead of using "LEFT JOIN lookup As t1" I have also tried "LEFT JOIN lookup t1" but the same error occurs: 1004 Authentication Failure. In some cases I need to shut down Excel (2013) and reload it in order to stop the error from reappearing - simply changing the query back to something that had worked earlier doesn't always work.

Any help would be appreciated.
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().

Forum statistics

Threads
1,221,310
Messages
6,159,176
Members
451,543
Latest member
cesymcox

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