Nested IIF

C

Cathy

I have a text box on a form which is trying to display the value from one of
three subforms depending on which subform is visible. I've written a nested
IIF statement, but for some reason only the first part works. It doesn't
give me any errors, and I can change which subform I place in the first
section... and only the first section will work. Can you spot what I have
wrong with this nested IIF? Thanks!

=IIf([subCategoriesComments2].[Form]![subCol1_Amount].[Visible],[subCategoriesComments2].[Form]![subCol1_Amount],(IIf([subCategoriesComments1].[Form]![subCol1_Amount].[Visible],[subCategoriesComments1].[Form]![subCol1_Amount],(IIf([subCategoriesComments].[Form]![subCol1_Amount].[Visible],[subCategoriesComments].[Form]![subCol1_Amount],0)))))
 
G

Graham Mandeno

Hi Cathy

I suspect that it the entire subform control that you are making
visible/invisible, not just the [subCol1_Amount] textboxes.

Try this:
=IIf([subCategoriesComments2].[Visible],[subCategoriesComments2].[Form]![subCol1_Amount],
.... )

Also, you could try having just one subform control and changing its
SourceObject, instead of having three subforms with only one visible. Then
your ControlSource would simply be:
=[subCategoriesComments].[Form]![subCol1_Amount]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top