473,386 Members | 1,764 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

How to display Current Year in formula WITH dates that are blank

anoble1
245 128KB
Hi,

I have a problem that I cannot figure out. I have a query that I am working on. It includes dates mm/dd/yyyy in a column. I want to just show the current year like this:
Expand|Select|Wrap|Line Numbers
  1. =Year(Now())
The query will not produce any results when I run it. I think the reason is because I have a few columns in their that the date field is blank. Before, I was searching with the criteria:
Expand|Select|Wrap|Line Numbers
  1. IS NOT NULL
My question is, how do I put in the query, like this?
Expand|Select|Wrap|Line Numbers
  1. IS NOT NULL & Year(Now())
Thanks,
Aug 25 '11 #1
3 2312
NeoPa
32,556 Expert Mod 16PB
This doesn't make good sense I'm afraid. I can't tell how much confusion is simply the wording of the question and how much is related to Access understanding (or lack of).

Perhaps you can clarify what you're actually asking for help with. Don't be afraid to use more detail or example data (or even your current SQL - a sanitised version if it's overly complicated).
Aug 25 '11 #2
anoble1
245 128KB
When I try to run the query with just using the
Expand|Select|Wrap|Line Numbers
  1. Year(Now())
which just displays this year correct? It comes up with no data. The reason is, is because I have a column of dates that contain blank dates (nothing is in there). How do I use the Year(Now()) formula, when my data is mixed between null dates, and **/**/**** dates?

Check it out.

http://s54.photobucket.com/albums/g8...5_09-36-47.jpg
Aug 25 '11 #3
NeoPa
32,556 Expert Mod 16PB
With so little information still I'll just have to guess what you're talking about and you can tell me if I'm anywhere near the mark.

It seems like you're trying to return a value of the current year (either numeric or string data) in a field which is a date by design. This is unlikely to make much sense, but it is conceivable so I'll have to allow you to make that judgement. Assuming that is (still) what you want to do then I suggest you convert the value into a string - otherwise the formatting of the field is likely to treat the numeric value as a date and you'll get something weird (quite different from what you want to see).

The formula for the query field would be something like :
Expand|Select|Wrap|Line Numbers
  1. Nz([DateField], CStr(Year(Date())))
Aug 25 '11 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Dave | last post by:
Hi, Can anyone tell me a simple way of inserting some sort of code into a Dreamweaver template (it goes at the bottom of the page in Copyright info) that will cause the current year to be...
3
by: Dixie | last post by:
How do I parse out the 20 from the current year (2005). I can get the last 2 numbers on their own, but have been unable to get the first two on their own. TIA dixie
2
by: Claudia Fong | last post by:
Hi, I need to add one to the current year so the year would be 2006. I'm using the code below and I put this code before the InitializeComponent() next_year and current_year are declare as...
5
by: mchlle | last post by:
I have a form that allows the user to choose and open a report from a drop down box based on the semester they choose from an option box. Option 1-3 are Spring, Summer and Fall and each semester...
5
by: Jimmy | last post by:
How do I set the default value of a text box (date/time) to 1/1/Current Year... i.e 1/1/2006 this year, 1/1/2007 next year?
4
by: john | last post by:
I have an unbound field in which I would like to show january 1 of the current year like this 01-01-2007. I tried this code but it doesn't work: =dateserial(Year(date()),1,1) Can someone help me...
8
by: sanika1507 | last post by:
Hi all how to write this 01/01/ and whatever year is coming as current year -1....in an SQL query .i want it to write it in a stored proc... using SQL server 2000. Thanks in advance . .
1
by: appu29 | last post by:
In my webpage, when i click "Past or Future" button to display "previous year leave summary or future year leave summary" respectively. It gives the error "Can't use an undefined value as a HASH...
2
by: clloyd | last post by:
I have a form that when you hit a command button it moves the current year value (could be three years prior) to a previous year field. I need code to insert the current year in the current year...
5
by: tbeers | last post by:
Good morning. I am running a timecard program in Access 2007 and it seems that the users have trouble entering the correct year when entering the date in the date field. Date field entry format...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.