rlb_wpg
Jun 27th, 2000, 12:05 AM
I've read the previous "grouping in database" solutions
and was hoping someone has come across & solved my
problem. Since I already have a provider, I am unable
to set my provider to MSDataShape and am therefore unable
to query using SHAPE.
---------------
Here's my code:
Dim cntTemp As New ADODB.Connection 'DB Connection
Dim rstTemp As New ADODB.Recordset 'Recordset
Dim cmdTemp As New ADODB.Command
Dim drptRpt As drptTemp
Const conConnect = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=SwitchDB;Data Source=SQLSERVER"
cntTemp.Open conConnect 'gconConnectSwitchDB
strSQL = "Select * from table order by field1"
With cmdTemp
.ActiveConnection = cntTemp
.CommandType = adCmdText
.CommandText = strSQL
.Execute
End With
With rstTemp
.ActiveConnection = cntTemp
.CursorLocation = adUseClient
.Open cmdTemp
End With
rstTemp.MoveFirst
Set drptRpt = New drptTemp
Set drptRpt.DataSource = rstTemp
With drptRpt
.Hide
.Sections("GrpHdr").Controls.Item(1).DataMember = ""
.Sections("GrpHdr").Controls.Item(1).DataField = rstTemp(0).Name
With .Sections("Detail").Controls
.Item(1).DataMember = ""
.Item(1).DataField = rstTemp(1).Name
.Item(2).DataMember = ""
.Item(2).DataField = rstTemp(2).Name
.Item(3).DataMember = ""
.Item(3).DataField = rstTemp(3).Name
.Item(4).DataMember = ""
.Item(4).DataField = rstTemp(4).Name
End With
.Show vbModal
End With
---------------
Without the detail section everything works fine. But
with the detail section I receive the following
error: "Report sections do not match data source"
Suggestions?
and was hoping someone has come across & solved my
problem. Since I already have a provider, I am unable
to set my provider to MSDataShape and am therefore unable
to query using SHAPE.
---------------
Here's my code:
Dim cntTemp As New ADODB.Connection 'DB Connection
Dim rstTemp As New ADODB.Recordset 'Recordset
Dim cmdTemp As New ADODB.Command
Dim drptRpt As drptTemp
Const conConnect = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=SwitchDB;Data Source=SQLSERVER"
cntTemp.Open conConnect 'gconConnectSwitchDB
strSQL = "Select * from table order by field1"
With cmdTemp
.ActiveConnection = cntTemp
.CommandType = adCmdText
.CommandText = strSQL
.Execute
End With
With rstTemp
.ActiveConnection = cntTemp
.CursorLocation = adUseClient
.Open cmdTemp
End With
rstTemp.MoveFirst
Set drptRpt = New drptTemp
Set drptRpt.DataSource = rstTemp
With drptRpt
.Hide
.Sections("GrpHdr").Controls.Item(1).DataMember = ""
.Sections("GrpHdr").Controls.Item(1).DataField = rstTemp(0).Name
With .Sections("Detail").Controls
.Item(1).DataMember = ""
.Item(1).DataField = rstTemp(1).Name
.Item(2).DataMember = ""
.Item(2).DataField = rstTemp(2).Name
.Item(3).DataMember = ""
.Item(3).DataField = rstTemp(3).Name
.Item(4).DataMember = ""
.Item(4).DataField = rstTemp(4).Name
End With
.Show vbModal
End With
---------------
Without the detail section everything works fine. But
with the detail section I receive the following
error: "Report sections do not match data source"
Suggestions?