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

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
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,214,534
Messages
6,120,086
Members
448,944
Latest member
sharmarick

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