Problems with loading forms

A

Andy

Hi Everyone,

I am very new to this but so far have managed to create a small database
with a few tables linked together and a few queries.

I have also created some reports and forms.

Using the switch board I would like to open a form in edit mode, which has
been filtered by default
base on the following two conditions:
- Status = Open
- Trace date = Any date during this week. Basically I would like the date
range to change automatically depending on the current week. The current
week being Monday to Sunday.

What is the code and where do I enter it?

I am using Access 2000.

Many thanks

Anguel.
 
R

Ron2005

one possibility

create a query to supply the data for the form you want to open.

In the status column add "OPEN" as the criteria
in the date field add the following as criteria

BETWEEN (DATE() - (Datepart("w",date(),2)-1) AND (DATE() -
((Datepart("w",date(),2)-1)+6)

explanation:
(Datepart("w",date(),2)-1)
The 2 is saying use Monday as first of week.
basically this is trying to compute the number of days to subtract from
today to get is the first of the week. (If this is not quite right you
will need to play with it to get it to do that.)

(DATE() - ((Datepart("w",date(),2)-1)+6)
This is the same calculation but it then is adding 6 to it to compute
the end of the week. (If you change the first part then change this one
to be identical.

Ron
 

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