Form is grow

  • Thread starter Thread starter alpapak via AccessMonster.com
  • Start date Start date
A

alpapak via AccessMonster.com

Form is grow
------------------------------------------------------------------------------
--

Hi

i have a form (Datasheet view)

Pay
PayID
DayOfPay
Details

i use it for a couple of month and it grow a lot
i want to open my form and see the last 30 Days only

i need a code because i am think to put it on open event()

thxs

*i am opening now my form and orderBy DayOfPay Desc
 
alpapak said:
Form is grow
------------------------------------------------------------------------------
--

Hi

i have a form (Datasheet view)

Pay
PayID
DayOfPay
Details

i use it for a couple of month and it grow a lot
i want to open my form and see the last 30 Days only

i need a code because i am think to put it on open event()

thxs

*i am opening now my form and orderBy DayOfPay Desc

Instead of basing your form directly on the table which holds your data,
you can base it on a query. Then set the criteria of the date field to
= DateAdd("d", -30, [DayOfPay]).

This will then only include those dates within 30 days of the Day of Pay.
 
thxs for the reply

if i make a query and then the form, i will not be able to click on the
button and show all records or click on another button and filter again my
records

my form will open with only the records (30 days)
there will be 3 button
1) cancel and show all records
2) show 30days only
3) search but all records

the 1 and 3 are working
but the 2 is my problem ==> how to open and show the records from the last
30 days
 
alpapak said:
thxs for the reply

if i make a query and then the form, i will not be able to click on the
button and show all records or click on another button and filter again my
records

my form will open with only the records (30 days)
there will be 3 button
1) cancel and show all records
2) show 30days only
3) search but all records

the 1 and 3 are working
but the 2 is my problem ==> how to open and show the records from the last
30 days

You can try using the filter property of the form for each of your three
buttons.

Button #2 would have code that would filter on the last 30 days.

Me.Filter = "[DayOfPay] >= #" & DateAdd("d", -30, Date()) & "#"
Me.FilterOn = True
 
thxs a lot

it works fine
1)can i add orderby [Date] and where?how?

2)is it possible to filter with 2 fields [Date] and [Pay]? Using the same
code
 
alpapak said:
Sorry mistake

Fields [DayOfPay] and [Pay]

Sure. All the filter does is act like a where clause.
Me.Filter = "[DayOfPay] >= #" & DateAdd("d", -30, Date()) & "# AND
[Pay]=12345"
Me.FilterOn = True
 
and what is the code with OrderBy??

Duncan said:
Sorry mistake

Fields [DayOfPay] and [Pay]

Sure. All the filter does is act like a where clause.
Me.Filter = "[DayOfPay] >= #" & DateAdd("d", -30, Date()) & "# AND
[Pay]=12345"
Me.FilterOn = True
 
Back
Top