Filter most recent week in data entry form

Tlewman

Board Regular
Joined
Dec 29, 2002
Messages
67
I have a form, based on a table, that I enter data into each morning. I have imported the last years worth of data into my table so there are quite a few records in my table. My questions is: How do I get my form to only show the most recent weeks worth of data. I had created a query and sorted my dates desc- giving me my most recent weeks first then limited it to my top 7 records (for the last 7 days). I then used this query as a filter on a macro that is attached to the button that opens the form. When I open it, the form still shows all records in the table (the most recent weeks are at the top, but it doesn't restrict to the top 7). What am I doing wrong?
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Hi,

have you considered basing the form on a query rather than the table? If you always want to show just the last week's records, in the query you can use an automatic filter such as <Now() - 8 {or something similar} in the criteria under the date field.

Alternatively the query could have a date criteria such as <=[enter first date] {or something simliar to take account of a null entry} and you can choose how many records you want to display every time the form opens - you could then change your button macro to close and reopen the form if you want to change the filter.

Lastly, there is an 'Apply Filter' option under the macro functions but I can't help you with that given I don't have Access on this PC and can't remember how to use it off the top of my head.

HTH, Andrew. :)
 
Upvote 0

Forum statistics

Threads
1,221,841
Messages
6,162,314
Members
451,759
Latest member
damav78

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top