User decide fields visible on report

Happy YN

Registered User.
Local time
Today, 19:34
Joined
Jan 27, 2002
Messages
425
I would like to build a form which lists all fields of a report and has a checkbox next to each one. By the user ticking the boxes, they decide which fields are visible on a report.
I could hardwire the whole thing, however, I would like this to be a stand alone module that I can put anywhere and it would be able to work with any report so I would like generic code to:-
  • list the fields of the report
  • put a check box next to them
  • have an option for the user to save their selection
I know one can make a list box with all field names in a table but:-
what about the fields in sql?
how can one put a check box next to each field on the list?


Thanks
 
In that case- you need to have an event for each checkbox. On click event should just need this

Code:
Call VisibileSelector(MyReport, MyFieldControl)

Then have a function something like that-

Code:
Public Function VisibleSelector(MyReport as Reports, MyFieldControl As Control)

'Execute your code here

End Function

This is off the top of my head. Read up on functions, how to pass an argument, and return it.

HTH.
 
No ! I think you have misunderstood me.
I need a code which will loop thru each checkbox using
for i =0 to end
if "chkbox" & i = true
then "txtbox" & i=visible

etc

Besides for that I need somewhere to store my choice and also of course something to list the fields

Thanks
 
My apologies.

You need to make sure all your checkbox have the same name (e.g. chkControl1, chkControl2, chkControl3

Then use a variable:

Code:
For i 1 to 20
    strControl = "chkControl" & i
    Me(strControl).Visible = False
Next i
 

Users who are viewing this thread

Back
Top Bottom