Syntax error in Join Operation

C

catherine2255

Hi,
I am trying to change my sql into a VBA action:

Original SQL =
UPDATE Tbl2 LEFT JOIN [NW14 for 33] ON Tbl2.Month = [NW14 for 33].Month
SET Tbl2.[Gross to Net] = [NW14 for 33].[Gross to Net], Tbl2.Quantity =
[NW14 for 33].[Quantity], Tbl2.Scrap = [Nw14 for 33].[Scrap],
Tbl2.Rework = [Nw14 for 33].[Rework]
WHERE (((Tbl2.Network)="Network 33"));

The VBA I have got to is:

strSQL="(UPDATE TBL2 LEFT JOIN" _
& " ([NW14 for 33]" _
& " ON Tbl2.Month = [NW14 for 33].Month)" _
& " SET Tbl2.[Gross to Net] = [NW14 for 33].[Gross to Net],"_
& ";Tbl2.Quantity=[NW14 for 33].Quantity,"
& ";Tbl2.Scrap=[NW14 for 33].Scrap,"
& ";Tbl2.Rework=[NW14 for 33].Rework"
& "WHERE (((Tbl2.Network)='Network 33'))"

When I run the VBA I get Syntax Error in Join operation. Any ideas on
how to fix this?
 
M

Michel Walsh

Hi,


Parenthesis at the wrong place. Your VBA code says:

UPDATE Tbl2 LEFT JOIN ( [NW14 for 33] ON Tbl2.Month = [NW14 for 33].Month )
SET ...



you could be able to remove these ( ), or if you wish to use them, as:

UPDATE ( Tbl2 LEFT JOIN [NW14 for 33] ON Tbl2.Month = [NW14 for
33].Month ) SET ...



Hoping it may help,
Vanderghast, Access MVP
 
C

catherine2255

thanks so much! it worked! its amazing what a couple of brackets can
do! lol
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top