473,382 Members | 1,147 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,382 software developers and data experts.

How do I convert #Error to empty

22
How do I convert #Error to empty in Year column in access Query?
Year colum is obtain by Year:year([date])
If I run the query it gives me error where there is no data in the row. pls help
Aug 24 '18 #1
5 2544
PhilOfWalton
1,430 Expert 1GB
Try

Expand|Select|Wrap|Line Numbers
  1. Iif(Not IsNull([date]), [date])
Note
Date is a reserved word and although Access will recognise [date] with the square brackets round it as a user defined field, I would strongly recommend renaming the field

Phil
Aug 24 '18 #2
zmbd
5,501 Expert Mod 4TB
Date is a reserved word and although Access will recognize [date] with the square brackets round it as a user defined field, I would strongly recommend renaming the field
Building on this - ALL of the words in these lists should be avoided for naming variables, tables, queries, etc... when designing ANY application in Access.
> http://allenbrowne.com/AppIssueBadWord.html
> https://support.office.com/en-ie/article/access-2007-reserved-words-and-symbols-e33eb3a9-8baa-4335-9f57-da237c63eabe
> https://docs.microsoft.com/en-us/office/client-developer/access/reserved-words-access-custom-web-app

(IMHO: It's best practice to avoid these words in other programing/application development environments as quite often the same tokens are reserved cross platform!)
Aug 24 '18 #3
NeoPa
32,556 Expert Mod 16PB
I would echo all that's been said already, but as a direct answer to your question try :
Expand|Select|Wrap|Line Numbers
  1. Year: IIf([Date] Is Null,Null,Year([Date]))
Change the field name in here once you've changed it in your table ;-)
Aug 24 '18 #4
Mafi
22
I tried all your suggestion and that error is still their. But i have sort out my problem by appending all the record to another table. thanks
Sep 13 '18 #5
NeoPa
32,556 Expert Mod 16PB
Mafi:
I tried all your suggestion and that error is still their.
I can only assume then that somewhere in the very little you've told us about your problem is a mistake.

For the situation you've outlined I can confirm the solution suggested in post #4 works 100% reliably. Even naming the field with a reserved word Year.

Perhaps you should try it again and pay attention to doing it exactly as posted this time.
Sep 13 '18 #6

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

Similar topics

3
by: Stephen Poley | last post by:
Could some kind soul explain the errors and warnings that the W3C CSS validator generates for page: http://www.atlis.nl/testsite/nl/ Results at: http://tinyurl.com/5pxqx The error "Invalid...
11
by: jguilford | last post by:
I have created a SQL Stored Procedure that uses a Case statement to determine the Order By. For one of the Case statements I am trying to turn a Char field into Datetime in for the Order By,...
3
by: eddy de boer | last post by:
Dear reader, In my code I get the following error: AddComment.cs(32): The best overloaded method match for 'WebLogger.Message.SelectMessage(string, out string, out string)' has some invalid...
0
by: Neil Young | last post by:
Hello group, I'm referring to a "rather old thread" (April 21st 2005). Because I also ran into problems with ASP.NET 2.0 formview and DBNull, but found a way around, I would like to share my...
8
by: **Developer** | last post by:
For WinSpool.SetPrinter a zero return indicates an error. SetLastError defaults to True in VB so I can get the errorcode as follows: ErrorCode = Marshal.GetLastWin32Error() The value is 6...
1
by: manikandan.r | last post by:
Hi I am accessing remote url through curl in my script. Sometimes i am getting the curl response as 'Empty reply from server', when the program runs. Can someone help me? --- Mani
2
by: sallyme | last post by:
Hi I am passing Date value form .asp form like "3/15/2007" And i am geting error Microsoft OLE DB Provider for ODBC Drivers (0x80040E07) Syntax error converting character string to...
1
by: Brad Pears | last post by:
I am using vb.net 2005 and SQL server 2000. In my table I have a date field of type "smalldatetime". In my vb application, the user may or may not enter a date value into the appropriate text box....
2
Jerry Maiapu
by: Jerry Maiapu | last post by:
I am trying to change the default error message "Object is invalid or no longer set" to a custome message. This error occurs when a required data is blank in the record source of the form. I have...
3
by: gullengd | last post by:
can you convert an empty string to a number?
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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...
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...

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.