Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2009

    Unanswered: Cycling through a subform record from the master form

    I have a form called Invoice that has a subform called Invoice_datasheet. The subform has the field Customer as the child link and Customer_Name in the Invoice form (The master) as the master link which means I have 2 tables as well.
    since my Invoice field is opened by a command button from another form, it is filtered out so that only one customer's invoices are shown at a time.
    On the other hand, I have a searchbox in the form Invoice to look up any Invoice ID for any customer and it has the following vb code:

    If Not IsNull(Forms![Invoice]![searchbox]) Then

    Me.Filter = ""

    Dim rs As Object
    Dim strLinkValue As String

    strLinkValue = Me![searchbox].Value
    Set rs = Me.RecordsetClone
    rs.FindFirst "[Invoice ID]=" & strLinkValue & ""
    Forms!Invoice.Bookmark = rs.Bookmark
    End If

    The searchbox works perfectly but I want to create two buttons (Previous and Next) that cycle through the Invoices for the current customer. The two buttons work perfectly if the filter is on, but after I use the searchbox to look up an InvoiceID, the filter gets cleared out so those two buttons will cycle through all the invoices and not just through the invoices for the current customer.
    How can I fix this? Is there any way to apply a filter so only current customer's invoices will be cycled?

    Any help will be greatly appreciated and sorry for the long post

  2. #2
    Join Date
    Mar 2009
    Provided Answers: 15
    Do not set the filter to nil, set it to something like:
    Customer = Customer_Name.

    Have a nice day!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts