help:printing specific reports for with differant fields

Hiten

Registered User.
Local time
Today, 15:06
Joined
Sep 17, 2001
Messages
51
Hi all, thanks to one of you i conquered my first problem, now my second one.

I have a contract table that you enter an order, for each product group. a product group has differant parrameters, so i used a select case and visible= true code to make certain fields pop up when certain product groups were selected.

Now that i have this info, i need to produce a contract. I have a contract template, but certain contracts do not have all the fields as each product group uses differant fields.

would i have to product a separate contract design for eac product group? and if so how will the system know which contract report to print?

Thanks again all

Hiten
 
If your main table has a field for "eac product group", and that is what determines the type of contract to print, then it's not too hard.

Let's say you have a form with a "print contract" button. You'll need some code in the "on click" for this button.

If your contracts are wildly different, I would set up a separate report for each type of contract. Then you would use either an Iif or Case structure, looking at the value of eac product group, and run the appropriate contract report.

If your contracts are only a very little bit different, you might just be able to use the same contract report, tweaking it from code. For example, if only two or three fields are different, you might look up these values in your form, then put them in invisible form fields, and have the report pick them up that way. This might be more work, and more confusing, in the long run.

The base code to select reports might look like this (off the top of my head):

Dim strDocName as String
...

Iif EAC_CODE = "A" then
strDocName = "rContractA"
else
Iif EAC_CODE = "B" then
strDocName = "rContractB"
End If
End If

DoCmd.OpenReport strDocName, acPreview
 

Users who are viewing this thread

Back
Top Bottom