I have a problem like current recordset does not support updating. Ms-access Database and excel VBA in the same PC its working perfectly.
If I access the excel VBA file and link the database from network PC, its not working.. occuring error like "current recordset does not support updating. this may be a limitation of the provider"
Code:
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim db As Variant
Dim strSQL As String
Dim wSheetName As Variant
db = "\\SIMPLAN-SWATHI\Users\mgt\dbdata.accdb" //Network DB path
cn.ConnectionString = "provider=Microsoft.ACE.OLEDB.12.0; Data Source=" & db
cn.Open
rs.Open "SELECT * FROM T_Booking;", cn, adOpenDynamic, adLockOptimistic
With rs
.AddNew
.Fields("部屋ID").Value = Val(Cells(Selection(1).Row, 1))
.Fields("利用期間開始日").Value = column_to_date(Selection(1).column)
.Fields("利用期間終了日").Value = column_to_date(Selection(Selection.Count).column)
.Fields("削除フラグ").Value = False
.Fields("更新日時").Value = Now
.Fields("登録日時").Value = Now
.Update
End With
//Color setting of cell
Selection.Interior.Color = bg_reserve_booking
Selection.Borders.LineStyle = xlContinuous
rs.Close
Set rs = Nothing
Set cn = Nothing