I've learned that releasing object variables may or may not actually deallocate the memory used by them and I seem to be having a problem with too much memory being used up (even though I've closed recordsets and set things equal to nothing). When the segment of code below runs, the reports all open, but then I get a message "There isn't enough free memory to update the display. Close unneeded programs and try again." and the computer wigs out. How can I force the memory to be deallocated?? (assuming this really is the problem)
Case 9 'UPD letter spon standard
'GET 1,4,7 LETTERS
Set Com = New ADODB.Command
With Com
.ActiveConnection = Con
.CommandType = adCmdStoredProc
.CommandText = "dbo.Check147"
.Parameters.Append .CreateParameter("@StudentNumber", adVarChar, adParamInput, 500, Trim(StudentNumber.Value))
.Parameters.Append .CreateParameter("@Country", adVarChar, adParamInput, 2, Trim(Country.Value))
End With
Set rstUpdateNum = Com.Execute
Set Com = Nothing
If Not rstUpdateNum.EOF Then
DoCmd.OpenReport "ReportName147", acViewPreview
End If
rstUpdateNum.Close
Set rstUpdateNum = Nothing
'GET 2,5,8 LETTERS
Set Com = New ADODB.Command
With Com
.ActiveConnection = Con
.CommandType = adCmdStoredProc
.CommandText = "dbo.Check258"
.Parameters.Append .CreateParameter("@StudentNumber", adVarChar, adParamInput, 500, Trim(StudentNumber.Value))
.Parameters.Append .CreateParameter("@Country", adVarChar, adParamInput, 2, Trim(Country.Value))
End With
Set rstUpdateNum = Com.Execute
Set Com = Nothing
If Not rstUpdateNum.EOF Then
DoCmd.OpenReport " ReportName258", acViewPreview
End If
rstUpdateNum.Close
Set rstUpdateNum = Nothing
'GET 3,6,9 LETTERS
Set Com = New ADODB.Command
With Com
.ActiveConnection = Con
.CommandType = adCmdStoredProc
.CommandText = "dbo.Check369"
.Parameters.Append .CreateParameter("@StudentNumber", adVarChar, adParamInput, 500, Trim(StudentNumber.Value))
.Parameters.Append .CreateParameter("@Country", adVarChar, adParamInput, 2, Trim(Country.Value))
End With
Set rstUpdateNum = Com.Execute
Set Com = Nothing
If Not rstUpdateNum.EOF Then
DoCmd.OpenReport “ReportName369", acViewPreview
End If
rstUpdateNum.Close
Set rstUpdateNum = Nothing