subform reports

bigmac

Registered User.
Local time
Yesterday, 22:47
Joined
Oct 5, 2008
Messages
302
hello all , can you help please , I have a subform that I want to produce a report from, but I do not want all the columns to be on the report .
I would like the user to be able to pick what is shown on the report , (I was thinking of using tick boxes in some way) or is there a better way of doing this please ?
 
perhaps have a multiselect listbox with a rowsource of your subform and the rowsource type set to field list. then users can select which fields they want to appear.

then in your report some code, perhaps on the open event or maybe the format event, to hide those fields not selected.
 
thank you CJ London, multi select list box looks a good way to do this, but not sure on the code ,
if I have three columns [column1] [column] [column3] how do I get it to hide [column2] for example
 
to get the selected values from the multiselect listbox, see this link.

https://support.microsoft.com/en-us/kb/827423

you can modify the code but in principle it will produce a string something like (assuming they are selecting the columns they want to display)

field1,field3,field5,field6

which you can pass to the report using the openargs parameter for docmd.openreport

in the report open event (you may need to try other events to get it to work) you would have some code along the following lines

Code:
 dim fldarr() as string
 dim I as integer
 fldarr=split(me.openargs,",")
 for I=0 to unbound(fldarr)
     me(fldarr(I)).visible=true 'for a continuous or single form
 next I
this assumes that you have set all the report 'column' controls visible property to false and the report is continuous.
 

Users who are viewing this thread

Back
Top Bottom