Solved

Getting #Error on a report field

Posted on 2014-11-21
3
179 Views
Last Modified: 2014-11-26
I have this control source for a field on a report but I'm getting #Error in the field if txtStandardWidthInInches is empty.

=IIf([txtStandardWidthInInches]="","",(CInt([txtStandardWidthInInches]/12) & "' " & [txtStandardWidthInInches] Mod 12 & """"))

How can I get rid of the #Error ?
0
Comment
Question by:SteveL13
3 Comments
 
LVL 24

Expert Comment

by:Phillip Burton
Comment Utility
try

=IIf(IsNull([txtStandardWidthInInches]),"",(CInt([txtStandardWidthInInches]/12) & "' " & [txtStandardWidthInInches] Mod 12 & """"))

or

=IIf(nz([txtStandardWidthInInches],"")="","",(CInt([txtStandardWidthInInches]/12) & "' " & [txtStandardWidthInInches] Mod 12 & """"))
0
 

Author Comment

by:SteveL13
Comment Utility
This did it...

=IIf(IsNull([txtStandardWidthInInches]),"",(CInt([txtStandardWidthInInches]/12) & "' " & [txtStandardWidthInInches] Mod 12 & """"))

Thanks!
0
 
LVL 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 500 total points
Comment Utility
Better yet - for a Report, create that field in the Query, instead of forcing Access to do that calculation in the report:

SELECT Col1, Col2, Nz(YourWidthColumn,0) / 12 & "' " & Nz(YourWidthColumn,0) MOD 12 & """ AS MyNewWidthColum FROM SomeTAble

Your query will not contain a column named "MyNewWidthColumn", and you can drop it directly on the report.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Familiarize people with the process of utilizing SQL Server functions 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 Ac…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now