Unhide column problem

captnk

Registered User.
Local time
Today, 06:19
Joined
Dec 12, 2001
Messages
148
On loading a subform,in a form I have a number of hidden columns in the subform,which I would like to make visible,(and hide some others),upon clicking a button.
I have tried all sorts of options,but have been unable to get them to appear or disappear.
Any help would be appreciated.
 
Is the subform based on a query? If so, go to query design an click on/off on the "show" option.
 
Looking further at this crazy problem,it may well be because my subform is displayed in datasheet format.
I like that because if u do take a column out the others move over,to fill the space like in a spreadsheet.
So really the question is can I hide/unhide columns in a datasheet,with a button.(not the hide option from a r/clk with the mouse)
 
On looking up help in VB - columnwidth
To hide a column set the width to 0
ie: Forms![Service Form]![Work in progress subform]![Client].ColumnWidth = 0
To reset it to the correct width
Forms![Service Form]![Work in progress subform]![Client].ColumnWidth = -2
This sets the column to the widest entry.

It shouldn't matter that the form is in datasheet view.

Just set the code to the 'on click' of your button. you can then hide/show any column you like.

Another idea is to code the button on click event to an if statement

IF yourbutton.caption = "Hide Some" then
Forms![Service Form]![Work in progress subform]![Client].ColumnWidth = 0
Forms![Service Form]![Work in progress subform]![Tech].ColumnWidth = -2
Yourbutton. caption = "Hide Others"
else
Forms![Service Form]![Work in progress subform]![Client].ColumnWidth = 150
Forms![Service Form]![Work in progress subform]![Tech].ColumnWidth = 0
Yourbutton. caption = "Hide Some"

endif

this saves having to have 2 buttons on your form.
HTH
Dave

[This message has been edited by Oldsoftboss (edited 01-24-2002).]

[This message has been edited by Oldsoftboss (edited 01-24-2002).]
 
Another possible solution, might be to toggle the visible property of the field you want hidden.
 

Users who are viewing this thread

Back
Top Bottom