navigation form customers form RRS feed

  • Question

  • I have a customers form with a combobox (klantlijst) to go select the customers

    the code is

    Private Sub klantlijst_AfterUpdate()
    Dim RS As DAO.Recordset
        If Not IsNull(Me.klantlijst) Then
            'Save before move.
            If Me.Dirty Then
                Me.Dirty = False
            End If
            Set RS = Me.RecordsetClone
            RS.FindFirst "[KLNO] = " & Me.klantlijst
            If RS.NoMatch Then
                MsgBox "Not found" 
                'Display the found record in the form.
                Me.Bookmark = RS.Bookmark
            End If
            Set RS = Nothing
        End If

    works fine

    but If a put this form in a navigation form , the combobox is not working

    I do not know why

    Monday, June 20, 2016 4:49 AM


  • Are you getting an error (what error message specifically)? 

    Your original code uses a combo box to control the recordset of the same form that the combo box is placed on.

    When using a navigation form, there may be a subform involved.  Depending on where your combo box is placed (is it in a main form or a subform), you may need to change the code to refer to the subform.  For example:

    ' This assumes the recordset is for the same form that the combo box is on:
    Set RS = Me.RecordsetClone
    ' If you want to display the records on a subform, you need to refer to the subform control:
    Set RS = Me.SubformControlName.Form.RecordsetClone

    Miriam Bizup Access MVP

    • Marked as answer by tekoko10 Monday, June 20, 2016 11:23 AM
    Monday, June 20, 2016 9:30 AM