Hide Controls in Subforms

J

Johnkl

Hello to the site

I'm having some problems when I try to hide some controls in my subfor
(datasheet view)

Depending on the user level I want some controls to be hidden so I use
the following code in the Form Open Event of the Subform

If Level= 1 Or Level = 2 Then
[Forms]![mySubform]![myControl].ColumnHidden = -1

But it doesn't do anything....

Any Ideas on what I'm doing wrong???
Any help would be appreciated ...

Kind regards
Joh
 
A

Andi Mayer..

Hello to the site

I'm having some problems when I try to hide some controls in my subform
(datasheet view)

Depending on the user level I want some controls to be hidden so I used
the following code in the Form Open Event of the Subform

If Level= 1 Or Level = 2 Then
[Forms]![mySubform]![myControl].ColumnHidden = -1

But it doesn't do anything....

Any Ideas on what I'm doing wrong???
Any help would be appreciated ...

Kind regards
John

what is ColumnHidden?

[Forms]![mySubform]![myControl].visible=false
 
J

John Vinson

Hello to the site

I'm having some problems when I try to hide some controls in my subform
(datasheet view)

Depending on the user level I want some controls to be hidden so I used
the following code in the Form Open Event of the Subform

If Level= 1 Or Level = 2 Then
[Forms]![mySubform]![myControl].ColumnHidden = -1

But it doesn't do anything....

Any Ideas on what I'm doing wrong???
Any help would be appreciated ...

Kind regards
John

It might be simplest to use a Continuous Form instead of a Datasheet,
and simply don't put textboxes on the form for those fields which you
want hidden. Or, use Conditional Formatting to make the textboxes
visible or invisible depending on the value of Level.

The ColumnHidden property can (I would guess, not having worked with
it) only be changed when the form is open in design view, not when
it's open in data view.

John W. Vinson[MVP]
 

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