Show current information in a Form

  • Thread starter Thread starter VIDDOM
  • Start date Start date
V

VIDDOM

Dear members, be patient I am a begginer.
I have a form wish shows me past events and future ones (we
have different events through the year), but everytime I
open it, the oldest event is shown, then I have to search
the one that I am interested in. Nevertheless, I am not
interested in searching for them, neither in the old ones
nor the future ones, but in the current ones. I can obtain
what I want through a filter, typing in the field "DATE"
the next expression "BETWEEN DATE()-30 AND DATE()+30" which
shows me the event done last month and the one for this
month. What I want is to have this information shown as
soon as I open the form (without clicking the filter button).
Additional Info:
1.The list of events come from a table called "EVENTS"
2.If I interested in past or future events, I want to be
able to see them.
Question:
What do I have to do, so that I can automaticaly retreive
this information everytime I open the form?

Thanks a lot
 
Try creating a select query with your "between" expression as the criteria
and then associate the query as your record source for the form.......

Hanksor
 
Dear members, be patient I am a begginer.
I have a form wish shows me past events and future ones (we
have different events through the year), but everytime I
open it, the oldest event is shown, then I have to search
the one that I am interested in. Nevertheless, I am not
interested in searching for them, neither in the old ones
nor the future ones, but in the current ones. I can obtain
what I want through a filter, typing in the field "DATE"
the next expression "BETWEEN DATE()-30 AND DATE()+30" which
shows me the event done last month and the one for this
month. What I want is to have this information shown as
soon as I open the form (without clicking the filter button).
Additional Info:
1.The list of events come from a table called "EVENTS"
2.If I interested in past or future events, I want to be
able to see them.
Question:
What do I have to do, so that I can automaticaly retreive
this information everytime I open the form?

Thanks a lot

Code the Load event of your form:

Me.Filter = "[YourDateField] between DateAdd('d',-30, Date()) and
DateAdd('d',30, Date())"
Me.FilterOn = True

To see all the records, not just those within this date period, simply
toggle the Remove Filter tool button to remove the filter.
 
Thanks for the code, It worked as I wanted. Have a nice day

-----Original Message-----
Dear members, be patient I am a begginer.
I have a form wish shows me past events and future ones (we
have different events through the year), but everytime I
open it, the oldest event is shown, then I have to search
the one that I am interested in. Nevertheless, I am not
interested in searching for them, neither in the old ones
nor the future ones, but in the current ones. I can obtain
what I want through a filter, typing in the field "DATE"
the next expression "BETWEEN DATE()-30 AND DATE()+30" which
shows me the event done last month and the one for this
month. What I want is to have this information shown as
soon as I open the form (without clicking the filter button).
Additional Info:
1.The list of events come from a table called "EVENTS"
2.If I interested in past or future events, I want to be
able to see them.
Question:
What do I have to do, so that I can automaticaly retreive
this information everytime I open the form?

Thanks a lot

Code the Load event of your form:

Me.Filter = "[YourDateField] between DateAdd('d',-30, Date()) and
DateAdd('d',30, Date())"
Me.FilterOn = True

To see all the records, not just those within this date period, simply
toggle the Remove Filter tool button to remove the filter.
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
.
 
Back
Top