dfistric
Aug 9 2008, 05:50 AM
Hi,
On main form I have text box control with following line:
=[sfrm_ListFiles].[Form]![Filename]
which displays the value of the filename text box on my subform (subform is in datasheet view)
Everything works ok if there is a data on subform, but problem arises when subform is empty, with no
data then i got this annoying message :
#Error
inside the control.
Is there anyway to prevent this to be shown.
Have the same problem when I have calculated control on my subform which calculates the values from
two or more fields. There is no problem on the lines where the data is entered, but in new line record line
it also shows #Error
Dubravko
cpetermann
Aug 9 2008, 06:11 AM
Dubravko,
It sounds like you need to handle nulls.
Try here Hope this helps,
Cynthia
rsindle
Aug 10 2008, 06:50 PM
I would get rid of the
=[sfrm_ListFiles].[Form]![Filename]
and leave the control unbound.
You can assign a value to the control, lets say "0" or a zero-length string "" on the current event of the Main form. That, way, as you navigate from record to record on the main form, you assign a "default" value to the control.
In the mainform Current Event:
Me!txtFilename = ""
Then, put code in the CurrentEvent of the subform that assigns the "correct" value to the main form.
The current event for the subform will fire whenever there is data in the subform, giving you the correct value. When it DOESN'T fire, because there was no data in the subform, the default value will show.
In the subform current event:
Me.Parent!txtFilename = Me.Filename
Hope this helps.
Rob
dfistric
Aug 11 2008, 07:30 AM
Thx for ideas,
Cynthia I think this is not Null issue because there is no data and Nz can't intercept that. This is more like Nothing situation.
I was trying to avoid Rob's solution also so that I don' put any code, but looks like that is only way to go.
Best regards,
Dubravko
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please
click here.