Solved

Access Form Control Source coding for Date field

Posted on 2015-01-19
4
355 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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.

708 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now