Hi there,
I have a table with Order Detail Lines, which I would like to add a picture to using a DSR from within crystal reports. There can be 1 or more detail lines, so I would like to display 1 or more images for a record.
I can successfully get the code to access the first record and show the image, but when I want to show the second record, it shows the original image!!!
Ive debugged it and watch that the detail section loops through the recordset, but it just re-opens the recordset again and starts from the beginning.
how can I get the recordset to move to the next record??
--------------
Private Sub DetailSection1_Format(ByVal pFormattingInfo As Object)
Dim myBmp As StdPicture
Dim crORS As ADODB.Recordset
Dim objConn As ADODB.Connection
Dim strConnect As String
Dim strSQL As String
Dim Order_ID As Double
strConnect = INI_getString("String", "ConnectString1", App.Path & "\dataconn.ini")
Order_ID = frmMain.TDBGridDebtB.Columns(0).Value
strSQL = "Select o.* from Order_Item o " & _
"where o.order_id =" & Order_ID
Set objConn = New ADODB.Connection
Set crORS = New ADODB.Recordset
crORS.Open strSQL, strConnect, adOpenStatic, adLockReadOnly
picFile = App.Path & "\image\"
crORS.MoveFirst
picFile = picFile & crORS.Fields("Batch_ID").Value & "_" & crORS.Fields("Image_ID").Value & ".jpg"
Set myBmp = LoadPicture(picFile)
Set Picture2.FormattedPicture = myBmp
End Sub
---------------
any help would be very appreciated
thanks
I have a table with Order Detail Lines, which I would like to add a picture to using a DSR from within crystal reports. There can be 1 or more detail lines, so I would like to display 1 or more images for a record.
I can successfully get the code to access the first record and show the image, but when I want to show the second record, it shows the original image!!!
Ive debugged it and watch that the detail section loops through the recordset, but it just re-opens the recordset again and starts from the beginning.
how can I get the recordset to move to the next record??
--------------
Private Sub DetailSection1_Format(ByVal pFormattingInfo As Object)
Dim myBmp As StdPicture
Dim crORS As ADODB.Recordset
Dim objConn As ADODB.Connection
Dim strConnect As String
Dim strSQL As String
Dim Order_ID As Double
strConnect = INI_getString("String", "ConnectString1", App.Path & "\dataconn.ini")
Order_ID = frmMain.TDBGridDebtB.Columns(0).Value
strSQL = "Select o.* from Order_Item o " & _
"where o.order_id =" & Order_ID
Set objConn = New ADODB.Connection
Set crORS = New ADODB.Recordset
crORS.Open strSQL, strConnect, adOpenStatic, adLockReadOnly
picFile = App.Path & "\image\"
crORS.MoveFirst
picFile = picFile & crORS.Fields("Batch_ID").Value & "_" & crORS.Fields("Image_ID").Value & ".jpg"
Set myBmp = LoadPicture(picFile)
Set Picture2.FormattedPicture = myBmp
End Sub
---------------
any help would be very appreciated
thanks