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

#Error from no data in a subFORM in Access 2003

I searched the Help files and found that you can get around the #Error result when trying to calculate data from a subREPORT which has no data with the HasData property, but can not figure out how to do it with a subform.
Microsoft Help

I even tried to set the visible property to no if it didn't hold a value, but apparantly Access considers "#Error" as a value.

I do not know VBA, but am trying to learn. If the solution requires a great deal of VBA, please explain the details.

Thank you.
Nov 27 '06 #1
13 4263
NeoPa
32,556 Expert Mod 16PB
What is the Control Source of your control set to?
I don't get that ever with my simple bound controls.
Nov 27 '06 #2
I have six subforms. The control is adding the sum from each of them. Sometimes one or more of the subforms has no data, hence #Error.

I've tried to make the control (which is located on the main form) invisible and set the visible property to yes if it's value is greater than zero, but get a type mismatch error.

I've tried conditional formatting, making the text the same color as my form's background, then change it to red if the value is greater than zero, but it doesn't work at all.

I've tried dealing with nz in all of my subforms.

I see there is a HasData property for subreports, but don't know if that applies to subforms, as well. No matter, I can't get it to work for the subreport, either.
Nov 27 '06 #3
What is the Contro Source of your control set to?
I don't get that ever with my simple bound controls.

By the way, this is an unbound control.
Nov 27 '06 #4
PEB
1,418 Expert 1GB
U don't have any formula in the respective control /as control source/ and it is unbound control and u get Error???

Very strange!!!

Have u indicated a special formatting for a number and having a default value text or something simillar????
Nov 27 '06 #5
NeoPa
32,556 Expert Mod 16PB
I think there is a formula PEB.
It's unbound but has a formula which refers to controls in six subforms.
It would be helpful to see the formula - I expect it's complicated.
Please use the CODE tags.
Nov 27 '06 #6
You are correct. It does have a formula but is not bound to any table or query. It's not even a complicated formula, just a sum of 3 fields from subforms in the same main form.

Expand|Select|Wrap|Line Numbers
  1. =nz(Forms![Work Order Summary Form]![Time Transaction Sum for WO Summary]!Text26)+nz(Forms![Work Order Summary Form]![Admin Material Sum 2]!Text5)+nz(Forms![Work Order Summary Form]![Work Order Summary Equipment subform]!Text7)
The formula does work when all of the subforms have data. It's when one or more of the subforms does not have data I receive #Error in the field.
Nov 28 '06 #7
NeoPa
32,556 Expert Mod 16PB
Try :
Expand|Select|Wrap|Line Numbers
  1. =Nz(Forms![Work Order Summary Form].[Time Transaction Sum for WO Summary].Text26,0)+Nz(Forms![Work Order Summary Form].[Admin Material Sum 2].Text5)+Nz(Forms![Work Order Summary Form].[Work Order Summary Equipment subform].Text7)
If this returns a #Error then we know we're dealing with a value other than Null.
Nov 28 '06 #8
cde
1
I had this same problem with a set of subForms on a program I migrated from Access 2 to Access 2003. I found that setting the properties on the subforms to allow Edits and allow Additions etc. cleared the #error on fields refering to the subform. The same program under Access 2 worked and did not require the property reset, everything else was the same even the code of the fields showing the errors. I also used Nz() and the original code using IIF with Is Null. I also noticed the Nz() function is very very slow compared to IIF.

I hope this helps - I struggled on this for hours.

cde
Dec 7 '06 #9
hjozinovic
167 100+
Hi there! I just solved the same problem with subreports and wanted to give something back too :-)

My situation was as follows: I had Main report and two subreports which calculated totals. I had one control on my Main report that calculated sum from both subreports.
When subreport was blank (had no data) the control on Main report was showing #Error.

To solve this put in Main controls record source the following statement (tip: press SHIFT+F2 for zoom!!):
Expand|Select|Wrap|Line Numbers
  1. =Nz(IIf(subReportName1.Report.HasData, subReportName1.Report!sumControl1, 0) + IIf(subReportName2.Report.HasData, subReportName.Report!sumControl2, 0), 0)
Hope it helps someone out!

Hrvoje
Oct 16 '07 #10
DanicaDear
269 256MB
hjozinovis's response had a couple of errors (; vs. , and missing ")" etc). This worked for me. Note I changed to my control/form names.
Expand|Select|Wrap|Line Numbers
  1. =Nz(IIf([subrptShopOrderTime].[Report].[HasData],[subrptShopOrderTime].[Report]![SOHours],0))
Dec 18 '18 #11
twinnyfo
3,653 Expert Mod 2GB
DanicaDear,

Thanks! I fixed the typos for future generations.

Glad you found a solution that worked!
Dec 18 '18 #12
DanicaDear
269 256MB
Good, because it looks like I may be missing an extra 0 on the end myself, to complete the Nz command. Thanks twinnyfo!
Dec 18 '18 #13
twinnyfo
3,653 Expert Mod 2GB
Glad I could hepp!

You hepped, too! You found the typo!
Dec 18 '18 #14

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

Similar topics

8
by: Steve | last post by:
I have several pairs of synchronized subforms in an application. I have a Delete button for each pair that uses the following code or similar to delete a record in the second subform: ...
6
by: Squirrel | last post by:
I have a command button on a subform to delete a record. The only statement in the subroutine is: DoCmd.RunCommand acCmdDeleteRecord The subform's recordsource is "select * from tblVisit order...
2
by: Bill Stock | last post by:
I have a subform which is causing a 3314 (Field can't contain a null value because required is set to True) error. I solved this problem by trapping it in the before update event. But then I...
9
by: Ecohouse | last post by:
I have a main form with two subforms. The first subform has the child link to the main form identity key. subform1 - Master Field: SK Child Field: TrainingMasterSK The second subform has a...
2
by: HNewt | last post by:
Access Error #2335 Access 2003. OS: Win XP Pro For a client I have created a database to track customers details and purchases. I have designed a form for data entry, the form is tabbed, the...
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: 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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.