Hiding an attachment

I've some trouble to hide an attachment in a database.

The commands (e.g. @IsNotMember("[Finance]";@UserRoles) or
@If(@Name([CN];@UserName) !="xxx yyy" ) are working on a Form but when I use them on Subforms and in Sections they don't seem to work.

I tried it in different way but the only I could do is to hide the whole section. Is there anything that functioning different on Subforms and Sections than on a normal Form?

My goal is with that database to prevent  not Finance users from opening an attachment, but even if I set Default to Author, the user with Author access can't edit other's Forms but they can open the attachment!
Who is Participating?
Sjef BosmanGroupware ConsultantCommented:
I suppose the attachment is in a Rich Text field? The whole Rich Text item has its own hide-whens per paragraph. See also

You could write some JavaScript to remove attachment tags from the HTML...
use this:
@Command( [RefreshHideFormulas] );
@Command( [SectionExpandAll] );
didier20Author Commented:
Yes, the attachment is in a Rich Text Field.

Where should I enter the lines?
@Command( [RefreshHideFormulas] );
@Command( [SectionExpandAll] );

Querysave, PostSave or Queryclose of the Subforms?

Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

based on your if condition, you can keep it in postopen. Make sure you keep the RTF field in a Section with Hidewhen formulae.
sjef's suggestion is the accepted one.  Basically, the subform loads when the form is opened.  If you want to switch to a hidden attachment subform, or a non-hidden subform, you have to decide this on either the query open or post open event and close and reopen the form to display the correct subform.

Basically, the form will open the default subforms as computed.  If after the document is open, you want to switch subforms, you have to close and reopen.
I don't recommend adding a Hidewhen to a RT field... these cache, and once hidden, it will stay hidden.
didier20Author Commented:
It's not an easy job working with RTF fields and hide when options.
You're right the best way is to create a subform (in my case 2 subforms with the option @If(@IsMember("[Finance]";@UserRoles);"RTF";"NonRTF")) and those will do.

I tried it with the Controlled Access Section as well, however it didn't work as expected.

In the above link I read following:
With the header hidden, the user can't open or close the section manually...

But in the properties box I can only hide the title and not header, and
I read too:
If you want to hide based on group or role membership, your formula can just name the  role(s)...

But when I enter [finance] as an Access formula and double click the Section (not in the Designer) a window appears with the following line:

Who may edit the contents of this section. (not from whom is it hidden)
And it shows [finance] what I wrote in the Access formula.
Ok, which do you want?

Rich text >>subforms, only thing that works consistently.  HOWEVER, for the subform to load, it has to load on Open,  so, if you decide that the person should be able to read rich text, you would have to close and reopen the form to load the subform.


The formula for the section should be computed-for-display and refer to a computed, or computed-for-display field at the top of the form.
The formula = "[Finance]":"[AnotherRole]"

I don't recall that a section hides any better because you still have to employ the hidewhen on the paragraph.  Once on, you can't take it off.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.