My Assistant
![]() ![]() |
|
|
Feb 22 2005, 09:53 AM
Post
#1
|
|
|
UtterAccess Addict Posts: 153 From: New York |
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! |
|
|
|
Feb 22 2005, 09:59 AM
Post
#2
|
|
|
UA Editor + Utterly Certified Posts: 22,726 From: Melton Mowbray,Leicestershire (U.K) |
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.. (IMG:http://www.utteraccess.com/forum/style_emoticons/default/thumbup.gif) |
|
|
|
Feb 22 2005, 10:18 AM
Post
#3
|
|
|
UtterAccess Addict Posts: 153 From: New York |
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? |
|
|
|
Feb 22 2005, 10:34 AM
Post
#4
|
|
|
UA Editor + Utterly Certified Posts: 22,726 From: Melton Mowbray,Leicestershire (U.K) |
Hi
You could apply the filter option based on a value. eg: CODE Me.Filter = "[YourFieldName] Like '*" & Me.txtBoxName & "*'" Me.FilterOn = True (IMG:http://www.utteraccess.com/forum/style_emoticons/default/thumbup.gif) |
|
|
|
Feb 22 2005, 10:48 AM
Post
#5
|
|
|
UtterAccess Addict Posts: 153 From: New York |
Where would I put this code, in the query or in the command button?
|
|
|
|
Feb 22 2005, 10:51 AM
Post
#6
|
|
|
UA Editor + Utterly Certified Posts: 22,726 From: Melton Mowbray,Leicestershire (U.K) |
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.. (IMG:http://www.utteraccess.com/forum/style_emoticons/default/thumbup.gif) |
|
|
|
Feb 22 2005, 11:56 AM
Post
#7
|
|
|
UtterAccess Addict Posts: 153 From: New York |
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 |
|
|
|
Feb 22 2005, 02:03 PM
Post
#8
|
|
|
UA Editor + Utterly Certified Posts: 22,726 From: Melton Mowbray,Leicestershire (U.K) |
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. (IMG:http://www.utteraccess.com/forum/style_emoticons/default/thumbup.gif) |
|
|
|
![]() ![]() |
|
Go to Top · Lo-Fi Version | Time is now: 20th June 2013 - 06:13 AM |