VBA for Next Record with and without Filtering

L

lilanngel

Hi there,

I'm interested in creating a button that will go to the Next Record. But it
automatically filters, so I need it to un-filter first.

To sum it up, I want it to say:
If there is a filter, then show all records and go to the next record.
If there is no filter, then go to the next record.

Should it look something like this: IIf (DoCmd.ApplyFilter = True) Then DoCmd.
ShowAllRecords (AND - not sure how to say AND) DoCmd.GoToRecord acDataForm ,
[Recipe Name],acNext Else DoCmd.GoToRecord acDataForm ,[Recipe Name],acNext

Also, the next question is... when the person reaches the last record, I want
it to display a very specific message, like "We love apple pie!" How can I do
this?
 
J

Jeanette Cunningham

hi lilanngel,

Turn the filter off using-->
Me.FilterOn = False

You can use that even if there is no filter in use.

Me.FilterOn = False
DoCmd.GoToRecord acDataForm, [Recipe Name],acNext


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 
L

lilanngel

Thank you very much!!

Jeanette said:
hi lilanngel,

Turn the filter off using-->
Me.FilterOn = False

You can use that even if there is no filter in use.

Me.FilterOn = False
DoCmd.GoToRecord acDataForm, [Recipe Name],acNext

Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
Hi there,
[quoted text clipped - 18 lines]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top