Click to See Complete Forum and Search --> : Not Enough Memory For Operation(VB 6.0,Crystal Report,MS-Access)


sujurajesh
November 27th, 2006, 10:50 AM
Dear All

I have a problem related to Crystal report.
I'm using VB 6.0, Crystal Report 7 and Ms-Access.
When I'm using SELECTIONFORMULA for filtering the following error is displayed.
"Not enough memory for operation"
But without this SELECTIONFORMULA report displayes all data, I can't filter.

Pls check the following code.

'// Code for printing

Public Sub sbCheckForPrint(crtReport As CrystalReport, Optional Destination As DestinationConstants = crptToWindow)
On Error GoTo Err_Trap
Dim ExpFilePath As String
ExpFilePath = App.Path & "\Report\Temp.aut"
If Dir(ExpFilePath) <> "" Then Kill (ExpFilePath)
crtReport.DiscardSavedData = True
crtReport.Destination = crptToFile
crtReport.PrintFileType = crptText
crtReport.PrintFileName = App.Path & "\Report\Temp.aut"
crtReport.Action = 1
If crtReport.RecordsSelected > 0 Then
crtReport.Destination = Destination
crtReport.Action = 1
Else
MsgBox "There is No Record for the Report", vbExclamation, "Information"
End If
If Dir(ExpFilePath) <> "" Then Kill (ExpFilePath)
Exit Sub
Err_Trap:
MsgBox Err.Description, vbExclamation, "Error"
End Sub

'\\ Code in the ShowReport Button

Private Sub cmdShowReport_Click()
On Error GoTo Err_Trap
Dim dtFromDate As Date
Dim dtTodate As Date
Dim strTitle1 As String
Dim strCondition As String

dtFromDate = Format(DTPFromDate.Value, "dd-mm-yyyy")
dtTodate = Format(DTPToDate.Value, "dd-mm-yyyy")

strCondition = "{HEADER_FILE.trdate} >= '" & dtFromDate & "' AND {HEADER_FILE.trdate} <= '" & dtTodate & "' "

CrtSalesReg.SelectionFormula = strCondition
CrtSalesReg.LogonInfo(0) = "DSN=;UID=;PWD=mydbs;dsq="
CrtSalesReg.DataFiles(0) = gServerPath
CrtSalesReg.ReportFileName = App.Path & "\Report\rptSALESREGISTOR.rpt"
strTitle1 = "For Transactions Between: " & Format(DTPFromDate.Value, "dd-MM-yyyy") & " To " & Format(DTPToDate.Value, "dd-MM-yyyy")
CrtSalesReg.Formulas(1) = "Title1 = '" & strTitle1 & "'"
If Len(cmbStore.Text) > 0 Or cmbStore.Text <> "" Then
strTitle2 = "Store: " & strStore
CrtSalesReg.Formulas(2) = "Title2 = '" & strTitle2 & "'"
Else
CrtSalesReg.Formulas(2) = "Title2 = '" & strTitle2 & "'"
End If
CrtSalesReg.WindowTitle = "Sales Registor Report"
CrtSalesReg.WindowState = crptMaximized
If MsgBox("Do you want to print?", vbYesNo + vbQuestion, strMsgBoxTitle) = vbYes Then
sbCheckForPrint CrtSalesReg
Else
Exit Sub
End If

Exit Sub
Err_Trap:
MsgBox Err.Description, vbExclamation, "Error"
End Sub

Dear All Please check the above code and send a reply asap.

Hope u will spend 10+ minuts for me


Thanks & Regards

Rajesh.K.M