Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Selecting fields on a form for inclusion in a report 2

Status
Not open for further replies.

bxgti4x4

Technical User
Feb 22, 2002
167
GB
I have a form which displays personal information for an employee (name, adddress, passport details, visa details etc.) The form contains 40 fields.

I would like to have a tick box alongside each field so that the user can select certain fields (e.g. passport details) and then press a command button (Create Report) which uses the selected fields to create a report.

Can anyone tell me how this can be done?

Best Regards
John
 
Hi

Simplest way to do this would be (I think):

Create a report based on the same recordset as the form, but with a criteria of the prime key from the form, hide the controls (on the report) which are not checked on the form.

In the beforeformat even of the report, put code like so

If Forms!myForm!MyCheckbox = True Then
Forms!myForm!MyControl.Visible = True
Else
Forms!myForm!MyControl.Visible = False
End If

the above code needs be repeated for each control, substituting the appropraite values fro MyForm, MyCheckBoxControl, MyControl

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Ken,

Thanks for the idea. It may take me a while to try it out but I'll let you know.

Best regards
John
 
Ken,

Small problem - I have created the button on the form which will open the report but I cannot find the "beforeformat" event to which you refer. Could you please tell me where to find it.

Thanks a lot,
John
 
Ken,

Sorry to be a pain but I have searched everywhere to find a reference to Before Form Event so that I can start building, but I have been able to find anything. I would appreciate some pointers on how to proceed.

Best Regards
John
 
Have a look at the OnFormat property of the Section object.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Ken and PHV,

Thank you both very much. Now I have the way in, I have it working well.

Best Regards
John
 
Ken/PHV

The code works fine and makes the appropriate controls visible or invisible. However, when it makes a control invisible you are left with a gap in the report between the visible controls either side of the invisible one.

Is there any way that this gap can be closed?

Best Regards
John
 
Ken,

Thanks for that, I'll give it a try.

Best Regards
John
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top