'Update function not working in MS Access Userform
Private Sub Command15_Click()
On Error Resume Next
Dim db As Database
Dim RST As Variant
Set db = CurrentDb
Set RST = db.OpenRecordset("SSPTab")
With RST
.Edit
.Fields(6) = Me.Reviewersname
.Fields(9) = Me.Assessments
.Fields(11) = Me.Review_Comments
.Fields(7) = Me.Reviewstatus
.Update
End With
I would like to open the existing row details and make changes to it and update. The above code is working fine for me except .Fields(7) , showing data conversion error.
Solution 1:[1]
Use proper declarations:
Private Sub Command15_Click()
Dim db As DAO.Database
Dim rst As DAO.Recordset
Set db = CurrentDb
Set rst = db.OpenRecordset("SSPTab")
With rst
.Edit
.Fields(6).Value = Me!Reviewersname.Value
.Fields(9).Value = Me!Assessments.Value
.Fields(11).Value = Me!Review_Comments.Value
' Field 7 must be Short Text or Long Text.
' .Fields(7).Value = Me!Reviewstatus.Value
.Fields(7).Value = Me!Revstats.Value
.Update
.Close
End With
End Sub
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
