error message

yoonie_85

Registered User.
Local time
Today, 06:24
Joined
Oct 4, 2004
Messages
12
Hello :)

I'm trying to run my module, but half way into it a pop up comes up saying something along the lines of "MSACCESS.exe has generated errors. and error log is being created. windows will shut down access".

i tried using the exact same code on another (smaller) program and it worked perfectly. just wondering if anyboday can suggest anything, i'm really need help. thanks

Code:
Sub Create()

Dim OriginalRS As Recordset
Dim DataRS As Recordset
Dim CustCode, PremCode, Cust2Code, Prem2Code As Long
Dim found As Boolean
Dim NumRecords As Long
Dim aRecord As Long

Set OriginalRS = CurrentDb.OpenRecordset("Res_phone", dbOpenDynaset)
Set DataRS = CurrentDb.OpenRecordset("NotInCustListLess18000", dbOpenDynaset)

CustCode = DataRS!CustCode
PremCode = DataRS!PremCode
Cust2Code = OriginalRS!Cust_Code
Prem2Code = OriginalRS!Prem_Code
aRecord = 1
OriginalRS.MoveLast
NumRecords = OriginalRS.RecordCount
OriginalRS.MoveFirst
found = False

Do Until DataRS.EOF
  Do Until found = True Or OriginalRS.EOF
    CustCode = DataRS!CustCode.Value
    PremCode = DataRS!PremCode.Value
    Cust2Code = OriginalRS!Cust_Code.Value
    Prem2Code = OriginalRS!Prem_Code.Value
      If CustCode = Cust2Code And PremCode = Prem2Code Then
        found = True
        Exit Do
      Else
        If aRecord < NumRecords Then
          aRecord = aRecord + 1
          OriginalRS.MoveNext
        Else
        aRecord = 0
        Exit Do
        End If
      End If
  Loop

  If found = True Then
   DataRS.Edit
   DataRS!PhoneNumber = OriginalRS!PhoneNumber
   DataRS!AreaCode = OriginalRS!AreaCode
   DataRS!Extention = OriginalRS!Extention
   DataRS.Update
  End If

  DataRS.MoveNext
  aRecord = 1
  OriginalRS.MoveFirst
  found = False

Loop

DataRS.Close
Set DataRS = Nothing
OriginalRS.Close
Set OriginalRS = Nothing
End Sub
 
I have had exactly the same problem. I posted on this site earlier this year, http://www.access-programmers.co.uk/forums/showthread.php?t=59619&highlight=msaccess.exe
and had a couple of suggestions.

I thought I had resolved the problem however it has reared its ugly head again, hence why I have revisited the site to see if anyone has found a solution.

Take a look at the replies to my posting, hopefully one of the suggestions will fix it for you.

Cheers
Rob
 
I have fixed the problem on my database now and I feel that it is caused by data corruption.

My code exports data as text files from various tables using pre saved export specifications. It seems that the table that stores the specifications becomes corrupted. I deleted the specification from the list, re-entered the specification with the same name and everything now works.

I hope this helps.

Cheers
Rob
 

Users who are viewing this thread

Back
Top Bottom