Memory could not be read ERROR

J

John

I am trying to run in code, a series of delete queries,
append queries and printing reports. After it gets to the
last part of the code, it give me a memory error message
and then kicks me out of Access.

If I run the queries manually one after the other, I do
not get a memory error message.

Am I doing something wrong in my code to cause this
error?

THANKS IN ADVANCE!!!

Here is my code:
Dim stdocName1 As String
Dim stdocName2 As String
Dim stdocname3 As String
Dim stdocname4 As String
Dim stdocname5 As String
Dim stDocName6 As String
Dim stDocName7 As String

Need to clear out tbltoolwatchbad, tbltoolwatchvalidate
and tbltoolwatchexport tables
stdocName1 = "DeltblToolWatchBad"
DoCmd.OpenQuery stdocName1, acNormal, acEdit

stdocName2 = "DeltblToolWatchValidate"
DoCmd.OpenQuery stdocName2, acNormal, acEdit

stdocname3 = "DeltblToolWatchExport"
DoCmd.OpenQuery stdocname3, acNormal, acEdit

'Append new tool records to tblToolWatchexport Table
stdocname4 = "AppNewToolRecords"
DoCmd.OpenQuery stdocname4, acNormal, acEdit


'Append new transfer records to tblToolWatchValidate table
'These records need to be validated
stdocname5 = "AppNewTransferRecords"
DoCmd.OpenQuery stdocname5, acNormal, acEdit

'Print outs of "Special Records" and "Jobs Not Open"

stDocName6 = "Jobs Not Open Report"
DoCmd.OpenReport stDocName6, acNormal

stDocName7 = "Jobs Not Open Report"
DoCmd.OpenReport stDocName7, acNormal
 
T

Tony C

Just a fewvsuggestion: -

Limit the amount of variables you are working with,
declare two variables "stQueryName" and "stReportName" and
use these two variables for declaring individual Query
Names and Report Names.

When running Action Queries, do not declare the Edit
Mode!! This can cause problems.

You are using the constant "acNormal" for opening the
Reports and Queries, this constant is invalid, change
these constants to "acViewNormal".

The statement "Need to clear out tbltoolwatchbad....", is
this a comment? If it is then Comment it!!

Friendly note, you are opening the same Report twice, are
you sure you want to do this?....

For debugging purposes, set your Reports so that they open
in "acViewPreview" mode then run the programme again, this
whole problem could be Hardware/Server related: -

Check that there is a Printer installed/mapped to the PC
you are running the Database from.
Check the amount of Disk Space available, if you have less
than 10Mb Of disk Space then I would suggest that you
clean up the Drive.

HTH


Tony C.
 

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

Similar Threads


Top