i need to update new records to the database. i created a button and typed the below mentioned code
But an error saying,"Current recordset does not support updating. this may be a limitation of the provider, or of the selected loc type" appears.
Could you please help
Private Sub Command3_Click()
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
rs.Open "SELECT * FROM SEAT WHERE LOCID='" & Combo4.Text & "'", con, adOpenKeyset, adLockReadOnly
If rs.EOF Then
rs.AddNew
Else: rs.Update
End If
rs!locid = Combo4.Text
rs!floorid = Combo5.Text
rs!seatno = Combo6.Text
rs!seatid = Text7.Text
rs!seattype = Combo7.Text
rs.Update
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
On Error GoTo Form_QueryUnload_Error
If Not con Is Nothing Then
If con.State Then con.Close
Set con = Nothing
End If
Form_QueryUnload_Done:
Exit Sub
Form_QueryUnload_Error:
MsgBox "An Error has occured in Procedure Form_QueryUnload." & vbCrLf & vbCrLf & Err.Number & " : " & Err.Description
Resume Form_QueryUnload_Done
End Sub
Private Sub Form_Load()
On Error GoTo Form_Load_Error
Set con = New ADODB.Connection
con.Open "Provider=Microsoft.Jet.Oledb.4.0;Data Source=" & App.Path & "\Office Utilization.mdb"
Call FillLocation
Call Filllocation2
Form_Load_Done:
Exit Sub
Form_Load_Error:
MsgBox "An Error has occured in Procedure Form_Load." & vbCrLf & vbCrLf & Err.Number & " : " & Err.Description
Resume Form_Load_Done
End Sub