Solved

Getting #Error on a report field

Posted on 2014-11-21
3
183 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
ID: 40457688
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
ID: 40457700
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
ID: 40457833
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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Can not open the Access Help ? 3 53
Create tables in access db (2016)  using vba 13 40
Modal form 11 29
Access subform not displaying on tab in naviation form 5 22
Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
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.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

808 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