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

problem displaying orderDetails in detail sections of datareport

Status
Not open for further replies.

aggeliki23

Programmer
Feb 12, 2007
38
GR
hello everybody,
I am new in vb6 and datareports too.
I am using vb6 and i am trying to display a data report based on an ado shape sql query. My query collects fields from table orders and table orderDetails and the 2 tables relates with OrderID. My problem is that when i display the report in details section appears the values srchOrders, i mean the values of fields of table orders. I tried to change the datamember value property but with no success. Any ideas please? Any help will be appreciate.

Private Sub PrintCmd_Click()
Dim z, q As Integer
z = 0
q = 0
sqlOrdDet = "Select * from OrderDetails " & _
"where OrderID='" & rsOrd!OrderID & "'"

rsOrdDet.Open sqlOrdDet, conn, adOpenStatic, adLockOptimistic

shapesql = _
" SHAPE {" & sql & "} AS SrchOrders " & _
"APPEND ({" & sqlOrdDet & "} AS SrchOrdDet " & _
"RELATE 'OrderID' TO 'OrderID') AS SrchOrdDet"


Set rsRep = New ADODB.Recordset
rsRep.ActiveConnection = conn
rsRep.CursorLocation = adUseClient
rsRep.Open shapesql, conn, adOpenStatic, adLockOptimistic, -1
rsRep.MoveFirst

Set DR1.DataSource = rsRep
DR1.DataMember = ""

With DR1.Sections("Orders").Controls
For intctrl = 1 To .Count
If TypeOf .Item(intctrl) Is RptTextBox Then
.Item(intctrl).DataField = rsRep(z).Name
.Item(intctrl).DataMember = Empty
z = z + 1
End If
Next intctrl
End With

'here i am trying to display the SrchOrdDet fields values
but with no effect, the SrchOrders fields values displays.

with DR1.Sections("OrdDetails").Controls
For intctrl = 1 To .Count
If TypeOf .Item(intctrl) Is RptTextBox Then
.Item(intctrl).DataMember = "SrchOrdDet"
.Item(intctrl).DataField = rsRep(q).Name
MsgBox .Item(intctrl).DataField
.Item(intctrl).DataMember = Empty
q = q + 1
End If
Next intctrl
End With

DR1.Refresh
DR1.Show

End Sub

Thank you
very much.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top