easy VBA / SQL question

Gates Is Antichrist

Well-known Member
Joined
Aug 15, 2002
Messages
1,961
I simply want to set a field in tbl1 to one in tbl2. Would someone please evaluate/test the following?

sSql = "UPDATE tbl1 SET [ShortDesc] = [tbl2].[FL8] from tbl1, tbl2;"
DoCmd.RunSQL sSql

FWIW, there is always exactly one record in tbl1, and exactly one record in tbl2. ("IF" logic will control whether FL8 or another field from tbl2 is today's lucky winner)

Extra credit question: supply the name of Microsoft's d***less P.O.S who devised the insultingly useless dialog 'Syntax error (missing operator) in query expression...'
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Well I get the same error.

Is there any relationship between the 2 tables?

I create ID's and tried this.
Code:
Sub test()
sSql = "UPDATE tbl1 LEFT JOIN tbl2 ON tbl1.tbl1ID = tbl2.tbl2ID SET tbl1.ShortDesc = [FL8];"

DoCmd.RunSQL sSql
End Sub

It seemed to work.
 
Upvote 0

Forum statistics

Threads
1,221,902
Messages
6,162,724
Members
451,782
Latest member
LizN

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