Full Version: Removing #Error text from form field based off subform
UtterAccess Forums > Microsoft® Access > Access Forms
psionic98
Hi all,
I have a main form that pulls 2 fields from the subform, however on opening up the form the subform will always have no data in it and so the main form always says #Error in the fields it would populate.
Is there a way to make that text not appear but rather the filed be null or even a zero.
I've tried using the default for the box property, and also IIF saying IIF(IsNull(subform.info), " ", subform.info) and even a few differnt OnLoad properties etc on the main form, but everything seems to be failing on me.
Any ideas, or am I stuck with this error code until the subform is populated?
Thanks in advance.
Stan
theDBguy
I would think that the IIf() method should work. Can you post the actual code for the textboxes on the main form?
psionic98
Sure.
st box returns a dollar amount between the main form and the subform grandtotal
=[checks]-[subform1].[Form]![TotPaySum]
had iif as follows
=IIF(IsNull([subform1].[Form]![TotPaySum]), " ", [checks]-[subform1].[Form]![TotPaySum])
and it would still show #Error
2nd box returns a Count between the main form and subform Count of records
=[Charge Amount Forms]-[subform1].[Form]![TotChkCnt]
had iif like the above, just with 2nd subform call
theDBguy
Thanks. What is the code behind [TotPaySum] and [TotChkCnt]?
psionic98
They are subform totals, basically =Count(Accounting Control) and =Sum(Total Payments) in the footer of the form used by the subform.
psionic98
Actually I can't believe it was this simple that I totally overlooked.
just set the IIF to check a field in the main form that would have to be populated for the subform to populate as well. IIF(IsNull([ControlNumberForm]), " ", Foirmat([checks]-[subform1].[Form]![TotPaySum],"#,##0.00"))
seems to work so far, works up liveupdating and on loading form from scratch.
theDBguy
Sorry it took me a while to understand what you're doing, but I'm glad you were able to figure it out on your own. Good luck with your project.
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.