Full Version: Problem With Bookmark
UtterAccess Forums > Microsoft® Access > Access Forms
mpriest
I have a bound form with a combobox to navigate through the records. When a name is selected from the combobox it displays the corresponding record using recordclone and bookmark properties:
CODE
        Set rst = Me.RecordsetClone
        intTempArray(1) = cboContactsByName
        rst.FindFirst "IDNbr = " & intTempArray(1)
        If rst.NoMatch Then
            MsgBox "Record not found"
        Else
            Me.Bookmark = rst.Bookmark
            cbocontacttype = rst!ContactType
            If IsNull(cbocasecategory) Or (cbocasecategory) Like "" Then
                cbocasetype.RowSource = "SELECT tblCaseType.IDNbr, tblCaseType.TypeID, tblCaseType.CaseType " _
                & "FROM tblCaseType " _
                & "ORDER BY tblCaseType.CaseType;"
            Else
                cbocasetype.RowSource = "SELECT tblCaseType.IDNbr, tblCaseType.TypeID, tblCaseType.CaseType " _
                & "FROM tblCaseType " _
                & "Where (((tblCaseType.TypeID) Like " & (cbocasecategory) & ")) " _
                & "ORDER BY tblCaseType.CaseType;"
            End If
            cbocasetype = rst!CaseType  **** >>This line causes error (Update or CancelUpdate Without AddNew Or Edit)
            cmdSave.Caption = "Update"
            cboContactsByCaseNbr = cboContactsByName
        End If
        rst.Close

The error I noted above happens if I select the same name from the combobox twice even after saving changes. The Help file says this error will occur because of the bookmark property being set. How do I get around this. Thanks in advance
ike
Graham R Seach
Why not just test the Bookmark?
If Me.Bookmark <> rst.Bookmark Then
'make the change
Else
'don't make the change
End If
Better still, filter the combo to prevent selecting the current record, and requery it every time you move to a new record.
mpriest
Thanks Graham for the help. The filter and requery worked perfect
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.