• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Help with DAO Edit Method in VB 6


When I try to edit a record in the database (Access 7.0) with this code I end up with :

1) The previous or next record is being Deleted

2) I then have 2 records with the same name as the one I am EDITING

3) There are only 2 FIELDS in the data base and I end up with one empty and one has double what it should have.

What is going on here?


Private Sub cmdSave_Click()
Dim Title As String
Dim N As String
Dim R As String
Dim T As String

Title = cmbTitles
N = cmbCatagories 'combobox with Table names
Set rs = db.OpenRecordset(N)
On Error GoTo fixit
R = rtfData.TextRTF
T = cmbTitles

If cmbTitles.Enabled Then
rs.LockEdits = True
rs.Edit
rs.Fields("Title") = T
rs.Fields("Recipe") = R
rs.Update
Set rs = Nothing
Else
rs.AddNew
If txtTitle.Text = "" Then
MsgBox "Belinda, you must add a name for this recipe"
txtTitle.SetFocus
Exit Sub
End If
rs.Fields("Title") = txtTitle.Text
rs.Fields("Recipe") = rtfData.TextRTF
rs.Update
rs.Bookmark = rs.LastModified
Set rs = Nothing
End If
 
Back
Top