Updating SQL Server table from Access VBA

MacroAlan

New Member
Joined
Aug 30, 2004
Messages
31
I have an Access database that was getting close to the 2gig limit so I converted the primary tables to SQL Server.

My query for pulling 195K rows into SQL table is working.

Before I begin producing reports, I need to update a number of fields on that master table.

Everything I do, I am getting a 3073 error; Operation must use an updatable query

The following query is constructed from a Recordset to give me the component parts.
Code:
UPDATE dbo_tbl_Sales_Data_Pass SET dbo_tbl_Sales_Data_Pass.[Lead Time Category] = '000-013' 
WHERE (((dbo_tbl_Sales_Data_Pass.[Num of Days Order to Request])>=0 
And (dbo_tbl_Sales_Data_Pass.[Num of Days Order to Request])<=13));
UPDATE dbo_tbl_Sales_Data_Pass 
SET dbo_tbl_Sales_Data_Pass.[Lead Time Category] = '000-013' 
WHERE (((dbo_tbl_Sales_Data_Pass.[Num of Days Order to Request])>=0 
And (dbo_tbl_Sales_Data_Pass.[Num of Days Order to Request])<=13));

Do I need to pass this thru a DAO.Connection? Is my syntax wrong?

Do I need to qualify the table with dbo.TableName?
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Why is the query code repeated twice?
Is that the way you really have it, or is that a typo?
 
Upvote 0
What do you mean by a sql query that is constructed from a recordset? You might need to give more of the code. Also your sql doesn't give a databasename in the sql so you'd have to be sure you are connected to the right database on the server.
 
Upvote 0

Forum statistics

Threads
1,224,845
Messages
6,181,300
Members
453,031
Latest member
Chris_1

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