![]() |
Best way to add info to a SQL database from Excel
I am programming excel to update data from a spreadsheet
into a blank database. I can update the database if there is a record in it but I can't seem to add a new record (using .AddNew). I keep getting read only errors and I cannot figure you what is wrong. I am using DAO with a DSN to connect to a SQL server Set wrkODBC = CreateWorkspace("NewODBCWorkspace", _ [MyUser], [MyPassword], dbUseODBC) With dbsFITSDB Set rstTemp = dbsFITSDB.OpenRecordset("my_input") Set dbsFITSDB = wrkODBC.OpenConnection([Connect], dbDriverNoPrompt, False) strQueryUpdateFX = "UPDATE my_input ....... " rstTemp.addnew dbsFITSDB.Execute strQueryUpdateFX End With End With Wend dbsFITSDB.Close wrkODBC.Close End Sub Thanks! |
All times are GMT +1. The time now is 05:14 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com