|
|
Is there a way to control which columns the user displays in Datasheet view? I have certain fields hidden, and I want to prevent the user from being able to display them by going to Unhide Columns.
Is there any event that is triggered when the columns in Datasheet view are changed, or is there some other way to control which columns are displayed in Datasheet view? I'm using Access 2003.
Thanks!
|
|
"Neil Ginsberg" <nrgins[ at ]gmail.com> wrote in message news:fB6Zk.9052$be.4012[ at ]nlpi061.nbdc.sbc.com...
[Quoted Text] > Is there a way to control which columns the user displays in Datasheet > view? I have certain fields hidden, and I want to prevent the user from > being able to display them by going to Unhide Columns. > > Is there any event that is triggered when the columns in Datasheet view > are changed, or is there some other way to control which columns are > displayed in Datasheet view? I'm using Access 2003. > > Thanks!
By far the easiest way is to make a custom commandbar which mimicks the datasheet commandbar in all but the unhide option, then use that as your form's commandbar.
Hint: Create a commandbar and Ctrl-drag items from the datasheet bar onto yours till you've got everything you want, then remove the unhide option.
|
|
Simplest way is to create a query that delivers only the fields you want. Then there is nothing for the user to unhide.
If that's not suitable, perhaps Continuous View would suit, rather than Datasheet View.
-- Allen Browne - Microsoft MVP. Perth, Western Australia Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org.
"Neil Ginsberg" <nrgins[ at ]gmail.com> wrote in message news:fB6Zk.9052$be.4012[ at ]nlpi061.nbdc.sbc.com...
[Quoted Text] > Is there a way to control which columns the user displays in Datasheet > view? I have certain fields hidden, and I want to prevent the user from > being able to display them by going to Unhide Columns. > > Is there any event that is triggered when the columns in Datasheet view > are changed, or is there some other way to control which columns are > displayed in Datasheet view? I'm using Access 2003.
|
|
well, you can set the control's Width property to zero in Design view, then add code to the form's MouseUp event to set the control's ColumnHidden property to True. you'll need to add a custom menu that does *not* have the Unhide Columns option, or just remove the menu bar entirely.
hth
"Neil Ginsberg" <nrgins[ at ]gmail.com> wrote in message news:fB6Zk.9052$be.4012[ at ]nlpi061.nbdc.sbc.com...
[Quoted Text] > Is there a way to control which columns the user displays in Datasheet
view? > I have certain fields hidden, and I want to prevent the user from being able > to display them by going to Unhide Columns. > > Is there any event that is triggered when the columns in Datasheet view are > changed, or is there some other way to control which columns are displayed > in Datasheet view? I'm using Access 2003. > > Thanks! > >
|
|
The problem is that the fields to be hidden in datasheet view need to be available in form view. Some of the fields are hidden in form view. (Unfortunately, setting Visible=False in form view doesn't equate to the field not being available in datasheet view.) Other fields just need to not be available in datasheet view for coding reasons. Thus, the query needs to contain those fields.
I could switch queries when the view changes; but that would requery the recordset, which would create other problems.
"Allen Browne" <AllenBrowne[ at ]SeeSig.Invalid> wrote in message news:49350a2e$0$18650$5a62ac22[ at ]per-qv1-newsreader-01.iinet.net.au...
[Quoted Text] > Simplest way is to create a query that delivers only the fields you want. > Then there is nothing for the user to unhide. > > If that's not suitable, perhaps Continuous View would suit, rather than > Datasheet View. > > -- > Allen Browne - Microsoft MVP. Perth, Western Australia > Tips for Access users - http://allenbrowne.com/tips.html> Reply to group, rather than allenbrowne at mvps dot org. > > "Neil Ginsberg" <nrgins[ at ]gmail.com> wrote in message > news:fB6Zk.9052$be.4012[ at ]nlpi061.nbdc.sbc.com... >> Is there a way to control which columns the user displays in Datasheet >> view? I have certain fields hidden, and I want to prevent the user from >> being able to display them by going to Unhide Columns. >> >> Is there any event that is triggered when the columns in Datasheet view >> are changed, or is there some other way to control which columns are >> displayed in Datasheet view? I'm using Access 2003. >
|
|
Thanks. This may be an impossible task. The users need Unhide Columns, because they like to change the fields that are displayed. I suppose I could give them a custom Unhide Columns dialog box, listing only the columns I want them to be able to use. That may be the only solution.
Would be nice if there was a Form_ColumnsChanged event that could manage it, or (better), under control properties, where it says Display When: instead of Screen and Print, have Screen, Print, Form View only, and Datasheet View only. That would be nice; but it isn't.
Thanks.
"tina" <nospam[ at ]address.com> wrote in message news:SWmZk.52218$_Y1.38201[ at ]bgtnsc05-news.ops.worldnet.att.net...
[Quoted Text] > well, you can set the control's Width property to zero in Design view, > then > add code to the form's MouseUp event to set the control's ColumnHidden > property to True. you'll need to add a custom menu that does *not* have > the > Unhide Columns option, or just remove the menu bar entirely. > > hth > > > "Neil Ginsberg" <nrgins[ at ]gmail.com> wrote in message > news:fB6Zk.9052$be.4012[ at ]nlpi061.nbdc.sbc.com... >> Is there a way to control which columns the user displays in Datasheet > view? >> I have certain fields hidden, and I want to prevent the user from being > able >> to display them by going to Unhide Columns. >> >> Is there any event that is triggered when the columns in Datasheet view > are >> changed, or is there some other way to control which columns are >> displayed >> in Datasheet view? I'm using Access 2003. >> >> Thanks! >> >> > >
|
|
The users want Unhide Columns, as they change the fields that are displayed. I could, I suppose, create a custom Unhide Columns function. That seems to be the only way.
"Stuart McCall" <smccall[ at ]myunrealbox.com> wrote in message news:uOZxw6FVJHA.4456[ at ]TK2MSFTNGP06.phx.gbl...
[Quoted Text] > "Neil Ginsberg" <nrgins[ at ]gmail.com> wrote in message > news:fB6Zk.9052$be.4012[ at ]nlpi061.nbdc.sbc.com... >> Is there a way to control which columns the user displays in Datasheet >> view? I have certain fields hidden, and I want to prevent the user from >> being able to display them by going to Unhide Columns. >> >> Is there any event that is triggered when the columns in Datasheet view >> are changed, or is there some other way to control which columns are >> displayed in Datasheet view? I'm using Access 2003. >> >> Thanks! > > By far the easiest way is to make a custom commandbar which mimicks the > datasheet commandbar in all but the unhide option, then use that as your > form's commandbar. > > Hint: Create a commandbar and Ctrl-drag items from the datasheet bar onto > yours till you've got everything you want, then remove the unhide option. > >
|
|
Neil Ginsberg wrote:
[Quoted Text] >Is there a way to control which columns the user displays in Datasheet view? >I have certain fields hidden, and I want to prevent the user from being able >to display them by going to Unhide Columns. > >Is there any event that is triggered when the columns in Datasheet view are >changed, or is there some other way to control which columns are displayed >in Datasheet view? I'm using Access 2003.
You might find something useful here: http://www.lebans.com/autocolumnwidth.htm
-- Marsh MVP [MS Access]
|
|
"Neil Ginsberg" <nrgins[ at ]gmail.com> wrote in message news:bVnZk.8559$yr3.2608[ at ]nlpi068.nbdc.sbc.com...
[Quoted Text] > The users want Unhide Columns, as they change the fields that are > displayed. I could, I suppose, create a custom Unhide Columns function. > That seems to be the only way. > > > "Stuart McCall" <smccall[ at ]myunrealbox.com> wrote in message > news:uOZxw6FVJHA.4456[ at ]TK2MSFTNGP06.phx.gbl... >> "Neil Ginsberg" <nrgins[ at ]gmail.com> wrote in message >> news:fB6Zk.9052$be.4012[ at ]nlpi061.nbdc.sbc.com... >>> Is there a way to control which columns the user displays in Datasheet >>> view? I have certain fields hidden, and I want to prevent the user from >>> being able to display them by going to Unhide Columns. >>> >>> Is there any event that is triggered when the columns in Datasheet view >>> are changed, or is there some other way to control which columns are >>> displayed in Datasheet view? I'm using Access 2003. >>> >>> Thanks! >> >> By far the easiest way is to make a custom commandbar which mimicks the >> datasheet commandbar in all but the unhide option, then use that as your >> form's commandbar. >> >> Hint: Create a commandbar and Ctrl-drag items from the datasheet bar onto >> yours till you've got everything you want, then remove the unhide option.
If you do create such a function, you should be aware of the fact that a column which is the default width (1 inch) and hasn't been altered since the form was opened will have a ColumnWidth value of -1. So when you loop over the Columns collection to fill your listbox, combo etc it's worth bearing that in mind (IOW <1 or >0 are not the comparisons to use).
|
|
|