Hiding a column on a sub-form (1 Viewer)

sc4prof

New member
Local time
Today, 06:59
Joined
May 8, 2015
Messages
3
I'm stuck.

I have a sub-form that is a datasheet view. What I want to do is to hide a column depending on the UserDisplayName(). I can get it to trigger easily enough but when I try to hide a field I get this:

Sorry, there's a problem. The property selected is invalid for this type of control.

Here is my "code":

SetProperty

Control Name: StatusComboBox
Property: Visible
Value: False



The problem is that it works fine on the calling form (for a different control), just not on the subform so I know that the "syntax" is correct.

There must be a trick that I am missing.....
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 03:59
Joined
Aug 30, 2003
Messages
36,129
In a Datasheet you need the ColumnHidden property.
 

CJ_London

Super Moderator
Staff member
Local time
Today, 11:59
Joined
Feb 19, 2013
Messages
16,651
you need to use the columnwidth property - the visible refers to forms, not datasheets

looks like you are using a macro so I would guess it would be something like

SetProperty

Control Name: StatusComboBox
Property: Columnwidth
Value: 0
 

sc4prof

New member
Local time
Today, 06:59
Joined
May 8, 2015
Messages
3
I'm sure it's something like that but I can't seem to get the syntax right for the control name. Both ColumnWidth and ColumnHidden throw errors.

The odd thing is that "visible" is an option in the GUI (attached)
 

Attachments

  • Capture.jpg
    Capture.jpg
    87.9 KB · Views: 190

AccessJunkie

Senior Managing Editor
Local time
Today, 03:59
Joined
May 11, 2006
Messages
278
Hi,

Since you posted your question into the Access web forum and your screenshot confirms that you are using an Access 2013 web app, the other suggestions offered by the other responders will not work at all. Access 2013 web apps are much different than Access desktop databases.

The short answer to your question is that it is not possible. While you can use the SetProperty macro action to dynamically show/hide individual controls on List and Blank views in Access 2013 web apps, this technique won't work on Datasheet views. The SetProperty action will always generate that type of error at runtime when you try to use it in a Datasheet view context.

--------------------
Jeff Conrad - Access Junkie - MVP Alumnus
Senior Content Developer - Modern Assistance and Support Experience - Microsoft Corporation

Author - Microsoft Access 2013 Inside Out
Author - Microsoft Access 2010 Inside Out
Co-author - Microsoft Office Access 2007 Inside Out
Access 2007/2010/2013 Info: http://www.AccessJunkie.com

----------
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/en-us/legal/Copyright/Default.aspx
----------
 

CJ_London

Super Moderator
Staff member
Local time
Today, 11:59
Joined
Feb 19, 2013
Messages
16,651
that looks like a continuous view form, not a datasheet, so the 'visible' property is the correct one.

It also looks like you are in design or layout view so the visible 'effect' will not take effect until you go to the normal view (otherwise you would never be able to make it visible again).

What are the options for Visible? - I can see 'visible' but what are the alternatives? I would expect 'Not Visible' rather than False as you are implying from your original post
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 03:59
Joined
Aug 30, 2003
Messages
36,129
Didn't notice the forum, so I'm sure Jeff is correct.
 

AccessJunkie

Senior Managing Editor
Local time
Today, 03:59
Joined
May 11, 2006
Messages
278
Hi CJ,

The poster is using an Access 2013 web app which is much different than Access desktop databases. Continuous forms do not exist in Access 2013 web apps. In that environment you only have four view types - List, Datasheet, Blank, and Summary.

The poster is using a datasheet view in their Access 2013 web app. The controls, properties, and macro actions available here are much different.

--------------------
Jeff Conrad - Access Junkie - MVP Alumnus
Senior Content Developer - Modern Assistance and Support Experience - Microsoft Corporation

Author - Microsoft Access 2013 Inside Out
Author - Microsoft Access 2010 Inside Out
Co-author - Microsoft Office Access 2007 Inside Out
Access 2007/2010/2013 Info: http://www.AccessJunkie.com

----------
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/en-us/legal/Copyright/Default.aspx
----------
 

CJ_London

Super Moderator
Staff member
Local time
Today, 11:59
Joined
Feb 19, 2013
Messages
16,651
I didn't notice either:banghead:
 

Users who are viewing this thread

Top Bottom