date calculation

  • Thread starter Thread starter Business analyst williams
  • Start date Start date
B

Business analyst williams

1. how do I code to prompt just to enter one date?
2. Once this date is entered how do I code it to subract 20 days from that
date entered.
3.Next, I have another date field that I do not want data pulled greater
than 45 days out.

I want to work like this:
Employee enters date..and the querie will pull on field all data greater
than 20 days, but another field no <= 45 days
 
You need a parameter in the query. This parameter must be defined. The SQL
statement would look something like this with the correct table and field
names.

PARAMETERS [Enter Date] DateTime;
SELECT tblDates.*
FROM tblDates
WHERE tblDates.[wa_date]>[Enter Date]-20
AND tblDates.[ex_date]<=[Enter Date]-45;
 
what is the wa_date and ex_date. I am assuming tblDates are the fields where
the calculations are coming from.

Jerry Whittle said:
You need a parameter in the query. This parameter must be defined. The SQL
statement would look something like this with the correct table and field
names.

PARAMETERS [Enter Date] DateTime;
SELECT tblDates.*
FROM tblDates
WHERE tblDates.[wa_date]>[Enter Date]-20
AND tblDates.[ex_date]<=[Enter Date]-45;
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.


Business analyst williams said:
1. how do I code to prompt just to enter one date?
2. Once this date is entered how do I code it to subract 20 days from that
date entered.
3.Next, I have another date field that I do not want data pulled greater
than 45 days out.

I want to work like this:
Employee enters date..and the querie will pull on field all data greater
than 20 days, but another field no <= 45 days
 
I do believe they are Wanted_Date and Excluded_Date fields.

--
Build a little, test a little.


Business analyst williams said:
what is the wa_date and ex_date. I am assuming tblDates are the fields where
the calculations are coming from.

Jerry Whittle said:
You need a parameter in the query. This parameter must be defined. The SQL
statement would look something like this with the correct table and field
names.

PARAMETERS [Enter Date] DateTime;
SELECT tblDates.*
FROM tblDates
WHERE tblDates.[wa_date]>[Enter Date]-20
AND tblDates.[ex_date]<=[Enter Date]-45;
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.


Business analyst williams said:
1. how do I code to prompt just to enter one date?
2. Once this date is entered how do I code it to subract 20 days from that
date entered.
3.Next, I have another date field that I do not want data pulled greater
than 45 days out.

I want to work like this:
Employee enters date..and the querie will pull on field all data greater
than 20 days, but another field no <= 45 days
 
what is the wa_date and ex_date. I am assuming tblDates are the fields where
the calculations are coming from.

Since you chose to post a question without mentioning either your table names
or your fieldnames, Jerry had to make some reasonable guess at what those
might be. Remember, neither he nor any of us can see your database!
 
tblDates is the table that I used for my testing. wa_date and ex_date are
fields in my table.

You will need to replace the table name and field names with those in your
database.

After doing so, open up a new query, but don't select a table. Next go to
SQL view the paste the revised SQL statement into that SQL view window. Run
it and see if ti works.
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.


Business analyst williams said:
what is the wa_date and ex_date. I am assuming tblDates are the fields where
the calculations are coming from.

Jerry Whittle said:
You need a parameter in the query. This parameter must be defined. The SQL
statement would look something like this with the correct table and field
names.

PARAMETERS [Enter Date] DateTime;
SELECT tblDates.*
FROM tblDates
WHERE tblDates.[wa_date]>[Enter Date]-20
AND tblDates.[ex_date]<=[Enter Date]-45;
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.


Business analyst williams said:
1. how do I code to prompt just to enter one date?
2. Once this date is entered how do I code it to subract 20 days from that
date entered.
3.Next, I have another date field that I do not want data pulled greater
than 45 days out.

I want to work like this:
Employee enters date..and the querie will pull on field all data greater
than 20 days, but another field no <= 45 days
 
Back
Top