Suddenly Receiving Run Time Error 2057

AngelSpeaks

Well-known member
Local time
Yesterday, 20:42
Joined
Oct 21, 2021
Messages
719
Last night, I noticed that my Access 2019 application was running very slow. A few days ago, I used it and it worked fine. I am now getting Run-time error '2057' (see below screen shot). I have rebooted, checked Windows Update, Checked my display device driver, all current. I noticed that several applications were updated on March 21st, including Office 2019 (so I ran a repair on it). Nothing.



1774454612868.png



This is Task Manager at the time of error. Any ideas? Windows 11 64bit Home. Thanks!

1774454846257.png
 
Click Debug. The VBA window opens.
Then Ctrl+L and the call stack will open. Is it a very long list? Then you may have unintended recursive code.
 
Update, it seems to be related to changes I've made to one form with a subform because all others are working.
 
Thanks Tom, I will check that out.
I tried it. It pointed to this code in Form_Current. I commented it out and no errors. Thanks. The Ctrl-L wasn't very long.

Code:
Private Sub Form_Current()
    glngEventID = Me.EventID
    'Check for images, get last if their are any, otherwise you'll get an error
   ' Dim LTotal As Long
   ' LTotal = DCount("ImageName", "tblImageFiles", "EventID= " & EventID)
  '  If LTotal > 0 Then
   '     GetLastImage
  '  Else
  '      Me.lblMessage.Caption = "There are no image files, please load them"
 '       Exit Sub
  '  End If
    Me.frmImageFiles.SourceObject = "sfrmImages" 'name of the form to load in sfrmSubform2 control

End Sub
 
Probably not cause of issue but have to ask - why is global variable set then not used?
 
Variations on stack overflow and heap overflow occur because issues in your running VBA code being careless with resource management. What (specifically) is "GetLastImage" and from where did you get it, or the idea for it? I ask that because nothing else in that code snippet could cause any kind of stack/heap error.
 
I tried it. It pointed to this code in Form_Current. I commented it out and no errors. Thanks. The Ctrl-L wasn't very long.

Code:
Private Sub Form_Current()
    glngEventID = Me.EventID
    'Check for images, get last if their are any, otherwise you'll get an error
   ' Dim LTotal As Long
   ' LTotal = DCount("ImageName", "tblImageFiles", "EventID= " & EventID)
  '  If LTotal > 0 Then
   '     GetLastImage
  '  Else
  '      Me.lblMessage.Caption = "There are no image files, please load them"
 '       Exit Sub
  '  End If
    Me.frmImageFiles.SourceObject = "sfrmImages" 'name of the form to load in sfrmSubform2 control

End Sub
What if you ONLY comment out 1 line with GetLastImage? The rest of the code in this procedure looks totally innocent.
 
Variations on stack overflow and heap overflow occur because issues in your running VBA code being careless with resource management. What (specifically) is "GetLastImage" and from where did you get it, or the idea for it? I ask that because nothing else in that code snippet could cause any kind of stack/heap error.
Last image is the most recent image added to the folder. I retrieve it's time stamp because I have a button I click to add images added to the folder, I compare it's time stamp. The application is a photo sharing application. When a camera is connected to the computer and a photo is transferred (via camera software or photo booth software), the image name, size, location , and orientation is added to tblImages. From this form, the image can be emailed, printed, or texted.
 
Code:
' ...
    Me.frmImageFiles.SourceObject = "sfrmImages" 'name of the form to load in sfrmSubform2 control
' ...

Probably not related, but do you really want to reload the subform on every record move?

Perhaps better:
Code:
' ...
  If Not Me.frmImageFiles.SourceObject = "sfrmImages" Then
    Me.frmImageFiles.SourceObject = "sfrmImages" 'name of the form to load in sfrmSubform2 control
'  Else
'    Me.frmImageFiles.Form.requery       ' uncomment if required
  End If
' ...
 
Further to above, what happens in the subform?

You say it's not bound. Are you using a recordset within it? Perhaps you're not destroying them properly, causing a memory leak?
 
Code:
' ...
    Me.frmImageFiles.SourceObject = "sfrmImages" 'name of the form to load in sfrmSubform2 control
' ...

Probably not related, but do you really want to reload the subform on every record move?

Perhaps better:
Code:
' ...
  If Not Me.frmImageFiles.SourceObject = "sfrmImages" Then
    Me.frmImageFiles.SourceObject = "sfrmImages" 'name of the form to load in sfrmSubform2 control
'  Else
'    Me.frmImageFiles.Form.requery       ' uncomment if required
  End If
' ...
Thanks for the suggestion.
 
Further to above, what happens in the subform?

You say it's not bound. Are you using a recordset within it? Perhaps you're not destroying them properly, causing a memory leak?
The subform is an image gallery, 3 images across and two down. The event ID that is passed to it is used in the select query to create a record set.
 
Have you got Unload code to close and destroy the recordset object variable?

Or are you just using the form's recordset via RecorSource?
 
Last image is the most recent image added to the folder. I retrieve it's time stamp because I have a button I click to add images added to the folder, I compare it's time stamp. The application is a photo sharing application. When a camera is connected to the computer and a photo is transferred (via camera software or photo booth software), the image name, size, location , and orientation is added to tblImages. From this form, the image can be emailed, printed, or texted.

This doesn't answer the question. I have to make some assumptions here. That is not a function that returns a value and from its syntax, it has no input arguments. This means that whatever it does, it uses global variables, Access objects, or Windows objects to do what it does. But you didn't tell us how it does whatever it does. Is it something you wrote? Did it come from a system or 3rd-party product library? Did you get it online? What IS it?
 

Users who are viewing this thread

Back
Top Bottom