Link to home
Start Free TrialLog in
Avatar of pandav
pandav

asked on

Two selection formula for main and subreport from vb- HOW?

i am using visual Basic 6 Ent Edition (SP5) and Cystal report 7. i  am sure other experts have seen similar problem.

i have a report with a subreport under the Report footer.
The problem is i have two selection formula which need to send it from visual basic dynamically.

strDate =  "{Customers.Balance} <> 0.00 and {Customers.Defaulter} = 'No' and {Payment.PaymentMonth} < DateTime( 2001 , 10 , 7 ) and  {Payment.PaymentMonth} < DateTime( 2001 , 10 , 14 )  AND {Collector.CollectorID}  = 2"

When i set the selectionformula for the main report as  
rptCrystal.SelectionFormula = strDate

And the report which is from sub report also will have a dynamic selection formula such as {Customers.Balance}<>0 and {Customers.PATO}='NP'. I can see the answers from crystal report itself.  From vb, it is NOT showing the subreport answers properly.

BUT, from visual basic, how do i set the selectionformula for main report as well as the subreport. It seems it can only take the selectionformula for the main report and not for the subreport.

thanks.
pandav
Avatar of raj_nbr
raj_nbr

Try one of these

1. Define a variable in main report which can be passed to sub report. In the sub report, use this variable (this variable can be seen from sub)for recordselection. From VB, pass selection formula to main report. You also need to pass the public variable to main report, which will in turn pass this to sub-report for record selection. Note that the second one( sub report passable variable) should be passed as formulas(index)= ..., and not as a selection formula itself

2. Define parameters in the sub-report for record selection. From VB, pass the parameter array to the crystal control.

Raj Nambiar

ASKER CERTIFIED SOLUTION
Avatar of Mike McCracken
Mike McCracken

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Question(s) below appears to have been abandoned. Your options are:
 
1. Accept a Comment As Answer (use the button next to the Expert's name).
2. Close the question if the information was not useful to you. You must tell the participants why you wish to do this, and allow for Expert response.
3. Ask Community Support to help split points between participating experts, or just comment here with details and we'll respond with the process.
4. Delete the question. Again, please comment to advise the other participants why you wish to do this.

For special handling needs, please post a zero point question in the link below and include the question QID/link(s) that it regards.
https://www.experts-exchange.com/jsp/qList.jsp?ta=commspt
 
Please click the Help Desk link on the left for Member Guidelines, Member Agreement and the Question/Answer process.  https://www.experts-exchange.com/jsp/cmtyHelpDesk.jsp

Please click you Member Profile to view your question history and keep them all current with updates as the collaboration effort continues, to track all your open and locked questions at this site.  If you are an EE Pro user, use the Power Search option to find them.

To view your open questions, please click the following link(s) and keep them all current with updates.
https://www.experts-exchange.com/questions/Q.20140968.html
https://www.experts-exchange.com/questions/Q.20192564.html
https://www.experts-exchange.com/questions/Q.20192992.html
https://www.experts-exchange.com/questions/Q.20243243.html
https://www.experts-exchange.com/questions/Q.20255450.html
https://www.experts-exchange.com/questions/Q.20266310.html

PLEASE DO NOT AWARD THE POINTS TO ME.  
 
------------>  EXPERTS:  Please leave any comments regarding your closing recommendations if this item remains inactive another seven (7) days.
 
Thank you everyone.
 
Moondancer
Moderator @ Experts Exchange

P.S.  For any year 2000 questions, special attention is needed to ensure the first correct response is awarded, since they are not in the comment date order, but rather in Member ID order.