Output to causing out of memory problem

P

Pat

I have a form that allows the user to create a report/letter
which can be previewed or printed with no problem.

I also have on the form a button that will output the report in rtf format
to
a word document that the user can save on his computer.

This button works fine but after the new file is created, the computer does
not have enough memory to move to another program like autocad for example
which
may have been already open.

Is there something that I should be doing to close thing or release some
thing so that this
doesn't happen.

the code includes:

Private Sub Command37_Click() 'SAVE TO FILE
On Error GoTo Err_Command37_Click

Dim DTE, FLNAME As String

Me![E LETER DATE].Format = "MM-DD-YY"
DTE = CStr(Format(Me![E LETER DATE], "MM-DD-YY"))
FLNAME = Me![JOB NUMBER] & " COVER LETTER " & DTE & ".RTF"

'MsgBox FLNAME
If MsgBox("SAVING LETTER TO " & Chr(13) & Chr(10) & FLNAME & " IN MY
DOCUMENTS" & Chr(13) & Chr(10) _
& "TO PROCEED CLICK OK, TO CHANGE FILE NAME OR CANCEL CLICK
CANCEL", vbInformation + vbOKCancel, _
"SAVE TO FILE") = vbOK Then

DoCmd.OutputTo acReport, "COVER LETTER", acFormatRTF, FLNAME, False

Else
DoCmd.OutputTo acOutputReport, "COVER LETTER", acFormatRTF, , False
End If

DoCmd.CLOSE acReport, "cover letter"
Me!SAVED = True

Exit_Command37_Click:
Exit Sub

Err_Command37_Click:
MsgBox Err.DESCRIPTION
Resume Exit_Command37_Click

End Sub

NOTE AGAIN THAT the code executes perfectly well, just have a problem with
memory afterwards

thanks
 
J

JohnFol

It sounds like a memory leak with the report and not the code. You could
eliminate the code completely by using the database window.

I know that Access used to have a memory leak with lines on reports, but I
though this was fixed around Acc95.
Apart from that it tends to be OS / Printer driver. What OS are you using
and which printer?
 
P

Pat

There are 5 or 6 people who would regularly use this
operation using Windows 98 through Windows Xp.
They're all connected to an HP laser printer, but when
using this command button, they don't print or even preview the report,
I know that the report has to opened and formatted etc, that's why I thought
that closing it might help, but it doesn't seem to.


JohnFol said:
It sounds like a memory leak with the report and not the code. You could
eliminate the code completely by using the database window.

I know that Access used to have a memory leak with lines on reports, but I
though this was fixed around Acc95.
Apart from that it tends to be OS / Printer driver. What OS are you using
and which printer?




Pat said:
I have a form that allows the user to create a report/letter
which can be previewed or printed with no problem.

I also have on the form a button that will output the report in rtf format
to
a word document that the user can save on his computer.

This button works fine but after the new file is created, the computer does
not have enough memory to move to another program like autocad for example
which
may have been already open.

Is there something that I should be doing to close thing or release some
thing so that this
doesn't happen.

the code includes:

Private Sub Command37_Click() 'SAVE TO FILE
On Error GoTo Err_Command37_Click

Dim DTE, FLNAME As String

Me![E LETER DATE].Format = "MM-DD-YY"
DTE = CStr(Format(Me![E LETER DATE], "MM-DD-YY"))
FLNAME = Me![JOB NUMBER] & " COVER LETTER " & DTE & ".RTF"

'MsgBox FLNAME
If MsgBox("SAVING LETTER TO " & Chr(13) & Chr(10) & FLNAME & " IN MY
DOCUMENTS" & Chr(13) & Chr(10) _
& "TO PROCEED CLICK OK, TO CHANGE FILE NAME OR CANCEL CLICK
CANCEL", vbInformation + vbOKCancel, _
"SAVE TO FILE") = vbOK Then

DoCmd.OutputTo acReport, "COVER LETTER", acFormatRTF, FLNAME, False

Else
DoCmd.OutputTo acOutputReport, "COVER LETTER", acFormatRTF, , False
End If

DoCmd.CLOSE acReport, "cover letter"
Me!SAVED = True

Exit_Command37_Click:
Exit Sub

Err_Command37_Click:
MsgBox Err.DESCRIPTION
Resume Exit_Command37_Click

End Sub

NOTE AGAIN THAT the code executes perfectly well, just have a problem with
memory afterwards

thanks
 
P

Pat

There are 5 or 6 people who would regularly use this
operation using Windows 98 through Windows Xp.
They're all connected to an HP laser printer, but when
using this command button, they don't print or even preview the report,
I know that the report has to opened and formatted etc, that's why I thought
that closing it might help, but it doesn't seem to.


JohnFol said:
It sounds like a memory leak with the report and not the code. You could
eliminate the code completely by using the database window.

I know that Access used to have a memory leak with lines on reports, but I
though this was fixed around Acc95.
Apart from that it tends to be OS / Printer driver. What OS are you using
and which printer?




Pat said:
I have a form that allows the user to create a report/letter
which can be previewed or printed with no problem.

I also have on the form a button that will output the report in rtf format
to
a word document that the user can save on his computer.

This button works fine but after the new file is created, the computer does
not have enough memory to move to another program like autocad for example
which
may have been already open.

Is there something that I should be doing to close thing or release some
thing so that this
doesn't happen.

the code includes:

Private Sub Command37_Click() 'SAVE TO FILE
On Error GoTo Err_Command37_Click

Dim DTE, FLNAME As String

Me![E LETER DATE].Format = "MM-DD-YY"
DTE = CStr(Format(Me![E LETER DATE], "MM-DD-YY"))
FLNAME = Me![JOB NUMBER] & " COVER LETTER " & DTE & ".RTF"

'MsgBox FLNAME
If MsgBox("SAVING LETTER TO " & Chr(13) & Chr(10) & FLNAME & " IN MY
DOCUMENTS" & Chr(13) & Chr(10) _
& "TO PROCEED CLICK OK, TO CHANGE FILE NAME OR CANCEL CLICK
CANCEL", vbInformation + vbOKCancel, _
"SAVE TO FILE") = vbOK Then

DoCmd.OutputTo acReport, "COVER LETTER", acFormatRTF, FLNAME, False

Else
DoCmd.OutputTo acOutputReport, "COVER LETTER", acFormatRTF, , False
End If

DoCmd.CLOSE acReport, "cover letter"
Me!SAVED = True

Exit_Command37_Click:
Exit Sub

Err_Command37_Click:
MsgBox Err.DESCRIPTION
Resume Exit_Command37_Click

End Sub

NOTE AGAIN THAT the code executes perfectly well, just have a problem with
memory afterwards

thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top