Solved

Access Form Control Source coding for Date field

Posted on 2015-01-19
4
363 Views
Last Modified: 2015-01-20
I have a daily down load of data that I do year around. This data does not need to include multiple years. So, every January this data search includes records from the previous year, which I do not need to carry over. I'd like it to only download the current year. However, the problem is that the source website will only allow me to download 1000 records maximum. Currently, there are about 500 records permonth so I just can't leave the control source set to 1-1-Current year.

Currenlty I am using
=DateSerial(Year(Date()),Month(Date()),Day(Date()))-90 (This is always 90 days less than "today's date")

However, I would like to change this.

I need the date to be January 1, Current Year. (1-1-2015) until 90 days of the current year have expired. Then I need it to be 90 days less than the current date. So every year it changes automatically with the calendar and will not include records from the previous year.
0
Comment
Question by:ggodwin
  • 2
  • 2
4 Comments
 
LVL 39

Accepted Solution

by:
als315 earned 500 total points
ID: 40558329
You can use this code for your field:
=IIf(CDate("1/1/" & Year(Now()))>DateAdd("d",-90,Now()),CDate("1/1/" & Year(Now())),DateAdd("d",-90,Now()))

Open in new window

0
 

Author Comment

by:ggodwin
ID: 40558612
Where does that code get entered at?
0
 
LVL 39

Expert Comment

by:als315
ID: 40559082
You can enter it to your field on a form, replacing your code:
=DateSerial(Year(Date()),Month(Date()),Day(Date()))-90
0
 

Author Closing Comment

by:ggodwin
ID: 40559826
Worked perfectly
0

Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question