Show current information in a Form

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
 
H

Hanksor

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
 
F

fredg

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.
 
G

Guest

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.
.
 

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