cardiacresearch
Programmer
Dear Reader-
I've created a datareport in VB6 without using the data environment. There is one grouping level, achieved using the SHAPE command. (Code below)
Unfortunately, the shape command does not seem to work in this situation. I get the following error…
Run-time error ‘-2147217900 (80040e14)’:
Invalid sql statement; expected ‘delete’, ‘insert’, ‘procedure’, ‘select’ or ‘update’.
Any thoughs?
Dim strSQL As String, strSQL2 As String
Dim db As Connection, rst As ADODB.Recordset
Set db = New Connection
db.CursorLocation = adUseClient
db.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=C:\VB\test dbase.mdb;"
strSQL = "SHAPE {SELECT tblpat.Age FROM tblpat} AS Command1 APPEND ({SELECT tblpat.Age, tbldata.RandNum FROM tblpat, tbldata WHERE tblpat.RandNum = tbldata.RandNum ORDER BY tblpat.Age, tbldata.RandNum} AS Command2 RELATE 'Age' TO 'Age') AS Command2"
Set rst = New ADODB.Recordset
rst.Open strSQL, db, adOpenStatic, adLockOptimistic
Set PoweredBySQLMulti.DataSource = rst
With PoweredBySQLMulti.Sections("section6"
.Controls ' Group header section
.Item("txtAge"
.DataField = "age"
End With
With PoweredBySQLMulti.Sections("section1"
.Controls ' Detail section
.Item("txtLastNm"
.DataField = "Last Name"
End With
PoweredBySQLMulti.Show
I've created a datareport in VB6 without using the data environment. There is one grouping level, achieved using the SHAPE command. (Code below)
Unfortunately, the shape command does not seem to work in this situation. I get the following error…
Run-time error ‘-2147217900 (80040e14)’:
Invalid sql statement; expected ‘delete’, ‘insert’, ‘procedure’, ‘select’ or ‘update’.
Any thoughs?
Dim strSQL As String, strSQL2 As String
Dim db As Connection, rst As ADODB.Recordset
Set db = New Connection
db.CursorLocation = adUseClient
db.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=C:\VB\test dbase.mdb;"
strSQL = "SHAPE {SELECT tblpat.Age FROM tblpat} AS Command1 APPEND ({SELECT tblpat.Age, tbldata.RandNum FROM tblpat, tbldata WHERE tblpat.RandNum = tbldata.RandNum ORDER BY tblpat.Age, tbldata.RandNum} AS Command2 RELATE 'Age' TO 'Age') AS Command2"
Set rst = New ADODB.Recordset
rst.Open strSQL, db, adOpenStatic, adLockOptimistic
Set PoweredBySQLMulti.DataSource = rst
With PoweredBySQLMulti.Sections("section6"
.Item("txtAge"
End With
With PoweredBySQLMulti.Sections("section1"
.Item("txtLastNm"
End With
PoweredBySQLMulti.Show