Hiding Columns

T

Thomas Kroljic

All,
I have a form that contains a subform (datasheet). When the main form
opens, depending on the users security, I will either hide or unhide one of
the columns in the subform. I use the following code to hide the column:

me.subform.form!fieldname.columnhidden = true

This works fine. But what I've noticed is if the column is hidden and the
user moves his/her's cursor to the last column in the datasheet, when the
cursor turn to the cross-hair +, the user is able to expand the hidden
column.

Is there a way to stop this? If the column is hidden, I do not want a
smart enduser unhiding it by using the cursor.

Thank you,
Thomas J. Kroljic
 
J

John Vinson

All,
I have a form that contains a subform (datasheet). When the main form
opens, depending on the users security, I will either hide or unhide one of
the columns in the subform. I use the following code to hide the column:

me.subform.form!fieldname.columnhidden = true

This works fine. But what I've noticed is if the column is hidden and the
user moves his/her's cursor to the last column in the datasheet, when the
cursor turn to the cross-hair +, the user is able to expand the hidden
column.

Is there a way to stop this? If the column is hidden, I do not want a
smart enduser unhiding it by using the cursor.

Rather than hiding the field, remove it altogether. Create two
queries, one with all fields for authorized users, and the other with
only the non-confidential fields for everyone else. Choose the
appropriate Recordsource for the subform based on the user's security.

John W. Vinson[MVP]
Join the online Access Chats
Tuesday 11am EDT - Thursday 3:30pm EDT
http://community.compuserve.com/msdevapps
 
T

Thomas Kroljic

John,
Thanks for the reply.
If I use different queries, one with the field, and another without the
field, how does the subform handle this? What I mean is, when I created the
subform, I created a text field (control) on the form for each field being
displaced. What will happen if one of the data fields is missing from the
query? Will I end up with "#####" in my column?

Thanks,
Thomas J. Kroljic
 
J

John Vinson

John,
Thanks for the reply.
If I use different queries, one with the field, and another without the
field, how does the subform handle this? What I mean is, when I created the
subform, I created a text field (control) on the form for each field being
displaced. What will happen if one of the data fields is missing from the
query? Will I end up with "#####" in my column?

You may need to have two separate forms (as well as two separate
queries); or you could get really sneaky and just have a calculated
field in the query to display NULL (or "You Are Not Authorized to See
This") in the forbidden fields.

If you go with the separate forms, you can change the SourceObject
property of the Subform control when you identify the user.

John W. Vinson[MVP]
Join the online Access Chats
Tuesday 11am EDT - Thursday 3:30pm EDT
http://community.compuserve.com/msdevapps
 
T

Thomas Kroljic

John,
Based on your response, am I correct in saying that even if you hide a
column, a smart user can user their cursor to unhide it when the form is
display?

Thomas J. Kroljic
 
J

John Vinson

John,
Based on your response, am I correct in saying that even if you hide a
column, a smart user can user their cursor to unhide it when the form is
display?

I'm really not certain! I haven't had to deal with hiding/unhiding
fields; typically when I have a security situation which requires some
users to have access to some data, and other users not, I'll provide
two different secured *frontend databases*, each with its own custom
set of forms and queries. But I've only had to do this once and the
two sets of users had quite different needs anyway, so it might be
overkill for your situation.

John W. Vinson[MVP]
Join the online Access Chats
Tuesday 11am EDT - Thursday 3:30pm EDT
http://community.compuserve.com/msdevapps
 
T

Thomas Kroljic

John,
Again, thanks for your ideas. I'll have to think about possible creating
a separate, second, front-end for the admin users. Currently, I have about
25 standard users and 5 admin users. Your logic is definitely something to
think about. I appreciate your comments and suggestions. It's always good to
hear how others would approach the situation. I always learn something new.
And I learned something here.

Thank you,
Thomas J. Kroljic
 

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