date calculation

  • Thread starter Business analyst williams
  • 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
 
J

Jerry Whittle

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;
 
B

Business analyst williams

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
 
K

KARL DEWEY

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
 
J

John W. Vinson

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!
 
J

Jerry Whittle

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
 

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