Solved

Getting #Error on a report field

Posted on 2014-11-21
3
186 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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

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…
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…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

831 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