-
hello...
i have a prb ... is regarding to display crystal report....means... how to get the crystal report display the selected records??
ex...
i have these Stocks
A001,A002,A003,A004, A005
i only select the A002, A003 and A004 to be display
and this is my code...
my database name is Inven.mdb
thanks
swiss
********************************************************
Private Sub cmdPrint_Click()
Dim sCondition, sTemp As String
sCondition = ""
sTemp = ""
mOK = True
If optSpecificStockCode.Value = True Then
sTemp = ("{stocktake.StockCode} >= " & cbStockCodeFrom.Text & _
" and {stocktake.StockCode} >= " & cbStockCodeTo.Text & "")
If sCondition = "" Then
sCondition = sTemp
Else
sCondition = sCondition & " and " & sTemp
End If
End If
If optPreview.Value = True Then
mDestination = crptToWindow
Else
mDestination = crptToPrinter
End If
Debug.Print "f=" & sCondition
With rpt
.Reset
.DataFiles(0) = (App.Path & "\Inven.mdb")
.ReportFileName = (App.Path & "\rptst.rpt")
.WindowTitle = "Stock Take Report"
.WindowState = crptMaximized
.WindowShowRefreshBtn = True
.SelectionFormula = sCondition
.Destination = ToDestination
If .PrintReport() <> 0 Then
MsgBox "Error #: " & .LastErrorNumber & vbCrLf & .LastErrorString
End If
End With
End Sub
**********************************************