Next,Previous Form for specific data

guestbb

Registered User.
Local time
Today, 13:16
Joined
Jul 14, 2015
Messages
44
I was wondering if there is a code for Next and Previous record in a form but for a specific value.
Example: I have a customer that has a specific ID and that customer has a list of orders that all contain that ID. When I open a form for orders I would like to be able by using Next and Previous record buttons to be able that was to move only through records of that customer not the whole list of orders for every customer.
Any ideas?
 
Apply a filter to the form, or change the RecordSource, such that the only records that appear in the form conform to your desired criteria. Then use the built-in Next and Previous buttons.
Code:
[COLOR="Green"]'open a form with a filter applied[/COLOR]
docmd.openform "fCustomer", , , "CustomerID = 16"
or
Code:
Private Sub cmdApplyFilter_Click()
[COLOR="Green"]'   applies a filter for the current customer's records only[/COLOR]
    me.filter = "CustomerID = " & me.CustomerID
    me.filteron = true
end sub
or something along those lines.
 

Users who are viewing this thread

Back
Top Bottom