cobrie04
Feb 22 2005, 09:53 AM
Hello,
Is there a way to cycle through a standard Access form record by record, but only showing the records where one of the fields is equal to a certain value?
I appreciate any and all help!
Larry Larsen
Feb 22 2005, 09:59 AM
Hi
I'll start at the very basic method and that's base your form on a select query which has some criteria set to = a certain value..
Some further details about your form setup may imply an alternative option..
cobrie04
Feb 22 2005, 10:18 AM
The main purpose of the form is to add records, but I would also like to be able to update existing records. If the person should open the form in Edit Mode, then I would like them to cycle through based on the criteria. Can you base a form on a query that will allow people to edit the records?
Is there a way to have my next button programmed with a loop that will cycle through the records where criteria is met?
Larry Larsen
Feb 22 2005, 10:34 AM
Hi
You could apply the filter option based on a value.
eg:
CODE
Me.Filter = "[YourFieldName] Like '*" & Me.txtBoxName & "*'"
Me.FilterOn = True
cobrie04
Feb 22 2005, 10:48 AM
Where would I put this code, in the query or in the command button?
Larry Larsen
Feb 22 2005, 10:51 AM
Hi
Command button on the form, I have seen a small listbox option which has a number of the form controls as values and is used as a filter by method..
cobrie04
Feb 22 2005, 11:56 AM
Hello,
I am pretty new to this stuff, so I am not sure why this is not working. I am getting errors for this code.
I just want to be sure I am asking this correctly.
I want a button that put simply, will go to the next record (where a certain field = 'O'). It will keep going to the very next record that meets the requirements until the end of the record set.
I tried this code on a command button called "next1"? Any ideas how to modify what I have to make it do what I want.... I really appreciate the help.
Private Sub next1_Click()
On Error GoTo Err_next1_Click
Me.Filter = "[banktype] = 'O' "
Me.FilterOn = True
DoCmd.GoToRecord , , acNext
Exit_next1_Click:
Exit Sub
Err_next1_Click:
MsgBox Err.Description
Resume Exit_next1_Click
End Sub
Larry Larsen
Feb 22 2005, 02:03 PM
Hi Chris
I think your misinterpreting the function of using the filter option, if you code is placed behind an button event it will filter the record source of records to match your criteria.
So all other records will be removed and all you ahve left/showing are records with "[banktype] = 'O' ".
Your code sequence of filtering and moving to the next record just tells it to move on one.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please
click here.