columnhidden on a report (1 Viewer)

bigmac

Registered User.
Local time
Today, 10:25
Joined
Oct 5, 2008
Messages
295
hello all can you help please , can you use "columnhidden on a report" I can get this to work on forms but not reports , if you can use it on a report what would be the correct syntax please , if not how do I hide columns on a report based on tickbox's for each column that are on a form .:confused:
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 01:25
Joined
May 7, 2009
Messages
19,229
you can use the Open event of the form to set the Width of the control to 0. and set the BorderStyle to 0 (no border). ie:

private sub report_open(cancel as integer)
me.columnToHide.Width = 0
me.columntoHide.BorderStyle = 0
end sub
 

bigmac

Registered User.
Local time
Today, 10:25
Joined
Oct 5, 2008
Messages
295
hi arnelgp, just one issue with this , if I use this on a column this is in between two other columns then it leaves a space on the report, how do I get the visble columns on the right of the one I have just shrunk to move right ?
 

CJ_London

Super Moderator
Staff member
Local time
Today, 18:25
Joined
Feb 19, 2013
Messages
16,608
you will need to modify the control left property - to follow on from arnelgp

private sub report_open(cancel as integer)
me.columnToHide.Width = 0
me.columntoHide.BorderStyle = 0
me.nextcolumn.left=me.columntohide.left
end sub

if this is a subreport, the other alternative is to use a form in datasheet as your subreport and use

me.columntoHide.columnwidth=0
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 01:25
Joined
May 7, 2009
Messages
19,229
if the format of your report is columnar, just edit your report. select all the column heading and the textboxes/comboboxes at the detail sections. then on the ribbon->Arrange, select Tabular. this will group all your headings and control fields. you can now use the code i posted you. the columns will adjust leaving no blank column in place.
 

Users who are viewing this thread

Top Bottom