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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

(cr8.5(RDC), VB6, Access 2000)

Status
Not open for further replies.

Frank336

MIS
Aug 6, 2002
41
CA

(cr8.5(RDC), VB6, Access 2000)

Hi,

How can I change the datasource of a subreport between 2 recordset at runtime ?

Im using this :

request1 = "Select ... "
Recordset1.Open requete, db, adOpenStatic, adLockOptimistic

request2 = "Select ... "
Recordset2.Open requete, db, adOpenStatic, adLockOptimistic


if Condition1 = True Then
Set CRSubreport = Report.OpenSubreport("subreport1")
CRSubreport.Database.SetDataSource Recordset1
else
Set CRSubreport = Report.OpenSubreport("subreport1")
CRSubreport.Database.SetDataSource Recordset2
end if


The first time i run the report, everything is ok, but the second time (without leaving the program) the setdatasource dont seem to change.


Another question that could solve my problem. What's wrong with that line :

CRSubreport.RecordSelectionFormula = "not isnull({ado.Date})"

Error : "This field name is not known"



Thanks,
Frank
 
(wrong topic..., Is there a way to edit these messages ?)
 



I solve my problem using parameters... (from VB to Report to Subreport)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top