Posted 4 August 2017, 2:32 pm ESTWhen I run a query against sql server via QA, I'm getting about 1000 hits. When I run a report using the same query, I'm only getting 13-pages. For development purposes, I've assigned the sql statement to the report datacontrol. However, at runtime, this will have to be changed. How can I do this?
Not getting all pages of report
Posted by: goth on 4 August 2017, 2:32 pm EST
Replied 4 August 2017, 2:32 pm ESTYou can reference the control through code -
rpt.(DataControlName).ConnectionString = ""
rpt.(DataControlName).SQL = ""
update these before you call rpt.Run and they should use the new information.
Replied 4 August 2017, 2:32 pm EST
<font face="Courier New" size="2">OK, here's what I've got...
Private Sub btnShowReport_Click()
Dim sConnString As String
Dim sSqlQuery As String
sConnString = "Provider=SQLOLEDB.1;Server=(local);Database=udbs_Development;User ID=foo;Password=bar;"
sSqlQuery = [really ugly select statement w/ 3-joins]
'-- using QA, the query returns 1,219 hits, but the report only
' shows 186 pages when it's previewed, I've a feeling the
' problem lies with the report itself
<font face="Courier New" size="2"> .DataControl1.ConnectionString = sConnString
.DataControl1.Source = sSqlQuery
'-- set all margins to 1/2"
.PageSettings.BottomMargin = 720
.PageSettings.TopMargin = 720
.PageSettings.LeftMargin = 720
.PageSettings.RightMargin = 720</font>
<font face="Courier New" size="2"> '-- preview report
<font face="Courier New" size="2"> End With