execution of this application has stopped due to a run-time error (1 Viewer)

Gismo

Registered User.
Local time
Today, 07:10
Joined
Jun 12, 2017
Messages
905
What description do you get for the error? (with the quotes)

I found this

vba - Is the MS-Access Navigation Pane visible? - Stack Overflow

if it's to do with the navigation pane, then it just can't be open in a run time - so maybe just use the fail1 to resume at the next test, or even the show ribbon process.

This is probably a time when you could have on error resume next until you get to the show ribbon. You may even get an error with the ribbon in the run time.
with or without the quotes I get the run time error
removing the Navigation code does not give an error on the sign on form

but when I go to the Menu, i get a run time error but I do not have the navigation on this form

I need to find what is causing the error on the next form which is my menu form

I get below compile error

msgbox "Fail1: Error " & err & " Desc: " & err.description"
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Yesterday, 23:10
Joined
Feb 28, 2001
Messages
20,861
I would say an app stopping abnormally is an event.

Probably right, Gasman, but it depends on who handled the error. If the Access Runtime's "Last Chance" error handler reported the error then to the system it was a non-event. If Windows handled the error, then it should have been an event.
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 05:10
Joined
Sep 12, 2006
Messages
14,630
Yes - but what run time error?

If you have error handling, you won't get the database crashing, and you will get informed of the error details.
 

bastanu

AWF VIP
Local time
Yesterday, 21:10
Joined
Apr 13, 2010
Messages
865
Maybe post the full code of the main menu Open, Load and Current events?
Cheers,
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 05:10
Joined
Sep 12, 2006
Messages
14,630
@Gismo I presume you didn't add error handlers. When you see "error" I assume you mean "crash"
So doing what I suggested with error handlers, I get an error at step1, (but only in the run time environment) but it is handled, and the error is the very unexpected error 3709 - "the search key was not found in any record". Definitely unexpected, as I normally see this error with corrupt databases.

So here's an accdb with the default form set to form1, and just your current event - (so that the equivalent accdr does try to open this form) Out of interest, I can't see a way to re-enable the ribbon, once it's turned off, so I have left it turned on.

So, copy this accdb to an accdr, and it won't crash, because there is now a error handler, but you get this strange error 3709

I originally used an unbound form and it crashed - but just in case the unbound form was the problem, I then added a table, and made form1 bound to table1, and the same thing happened.

So the issue is this strange unexpected error trying to manage the dbs window in a run time environment.

Assuming this error 3709 here can be disregarded, then it's an easy fix.
 

Attachments

  • crashing.accdb
    476 KB · Views: 49
Last edited:

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 05:10
Joined
Sep 12, 2006
Messages
14,630
@bastanu . I assume the OP issued a accdb, and wanted to add extra protection against viewing it at all.
 

bastanu

AWF VIP
Local time
Yesterday, 21:10
Joined
Apr 13, 2010
Messages
865
Dave, I have never used the runtime version but my understanding of it was it doesn't matter what extension you use, you just do not get the navigation pane and ribbon. Accdb and accde should look the same in the runtime version, other of course that the accde would prevent access to the code.

Cheers,
 

Gismo

Registered User.
Local time
Today, 07:10
Joined
Jun 12, 2017
Messages
905
The Access runtime does not have the navigation pane (or default ribbon) so if all your users are using the runtime why have the code to hide it to begin with?
We only installed runtime recently
I was thinking the same thing, I am the only user with full office package so having the ribbon and navigation pane visible wont be a problem, I also want to have the DB in a state where it will be compatible in the future should any other user use the full office package to have the ribbon and navigation pane hidden, so I will most probably want to keep them hidden
 

Gismo

Registered User.
Local time
Today, 07:10
Joined
Jun 12, 2017
Messages
905
@Gismo I presume you didn't add error handlers. When you see "error" I assume you mean "crash"
So doing what I suggested with error handlers, I get an error at step1, (but only in the run time environment) but it is handled, and the error is the very unexpected error 3709 - "the search key was not found in any record". Definitely unexpected, as I normally see this error with corrupt databases.

So here's an accdb with the default form set to form1, and just your current event - (so that the equivalent accdr does try to open this form) Out of interest, I can't see a way to re-enable the ribbon, once it's turned off, so I have left it turned on.

So, copy this accdb to an accdr, and it won't crash, because there is now a error handler, but you get this strange error 3709

I originally used an unbound form and it crashed - but just in case the unbound form was the problem, I then added a table, and made form1 bound to table1, and the same thing happened.

So the issue is this strange unexpected error trying to manage the dbs window in a run time environment.

Assuming this error 3709 here can be disregarded, then it's an easy fix.
I added the code as suggested, I do get the 3709 error
"The search key was not fount in any record"

what will the fix be?

My sign on form seems to be ok, The crash now happens on the menu form

below is the code on the menu form


Option Compare Database
Option Explicit
Private Sub Form_Current()

If Me.Admin = "0" And Me.SAP = "0" Then
Me.Invoicing.Visible = False
Me.TECO.Visible = False
Me.Spares.Visible = False
Me.AdminSetup.Visible = False
Else
Me.Invoicing.Visible = True
Me.TECO.Visible = True
Me.Spares.Visible = True
Me.AdminSetup.Visible = True
End If

If Me.Margin = "0" Then
Me.BalanceSheet.Visible = False
Else
Me.BalanceSheet.Visible = True
End If

End Sub

Option Compare Database
Option Explicit
Private Sub Form_Load()

DoCmd.SetWarnings False
DoCmd.OpenQuery "Clear User Log"
DoCmd.SetWarnings True

End Sub


Subform

Option Compare Database
Option Explicit

Private Sub Form_Current()
If Me.RecordsetClone.RecordCount = 0 Then
DoCmd.SetWarnings False
DoCmd.OpenQuery "Update_Registration_All"
DoCmd.SetWarnings True
End If

If IsNull(Me.Registration) Then
Me.RefreshBtn.Visible = False
Me.Stock.Visible = False
Else
Me.RefreshBtn.Visible = True
Me.Stock.Visible = True
End If

Private Sub Form_Load()
If Me.RecordsetClone.RecordCount = 0 Then
DoCmd.SetWarnings False
DoCmd.OpenQuery "Update_Registration_All"
DoCmd.SetWarnings True
End If

If IsNull(Me.Registration) Then
Me.RefreshBtn.Visible = False

Else
Me.RefreshBtn.Visible = True

End If
End Sub

Sub Sub form
Private Sub Form_Current()

If Me.RecordsetClone.RecordCount = 0 Then
DoCmd.SetWarnings False
DoCmd.OpenQuery "Update_Registration_All"
Me.Requery
DoCmd.SetWarnings True
End If
Me.Parent!DefectLink = Me![Defect]
Me.Parent!DefectLink = Me![Highlight]
Me.Refresh
End Sub
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 05:10
Joined
Sep 12, 2006
Messages
14,630
As I said, I was surprised to get that particular error 3709.
As long as this is consistent and is the expected error than it's safe to change the fail1 error hander to just carry on. Note that you have to resume from an error handler, not just goto.

The point about error handlers is that you just cant say

on error resume next every time, and just ignore every error. because some errors are critical, if you will.
but including error handlers prevents the code from crashing. - ie the code picks up the error, and lets the programme continue - rather than access just closing.

Code:
if err=3709 then
           'we expected this error, so ignore it and carry on
           resume step2
      else
           msgbox "Fail1: Error " & err & "  Desc: " & err.description"
           resume exithere
          'or even terminate access
    end if
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 05:10
Joined
Sep 12, 2006
Messages
14,630
Dave, I have never used the runtime version but my understanding of it was it doesn't matter what extension you use, you just do not get the navigation pane and ribbon. Accdb and accde should look the same in the runtime version, other of course that the accde would prevent access to the code.

Cheers,

I know, but error 3709 seems an unusual error to get when you are trying to interact with the dbs window. Maybe the OP would have got the same error in an accde. Once you know you need error handlers in place, it's easier to deal with.
 

Gismo

Registered User.
Local time
Today, 07:10
Joined
Jun 12, 2017
Messages
905
As I said, I was surprised to get that particular error 3709.
As long as this is consistent and is the expected error than it's safe to change the fail1 error hander to just carry on. Note that you have to resume from an error handler, not just goto.

The point about error handlers is that you just cant say

on error resume next every time, and just ignore every error. because some errors are critical, if you will.
but including error handlers prevents the code from crashing. - ie the code picks up the error, and lets the programme continue - rather than access just closing.

Code:
if err=3709 then
           'we expected this error, so ignore it and carry on
           resume step2
      else
           msgbox "Fail1: Error " & err & "  Desc: " & err.description"
           resume exithere
          'or even terminate access
    end if

I am ok with the result from the login form

not sure why it crashes on menu form
non of my other DB's have this problem
 

Gismo

Registered User.
Local time
Today, 07:10
Joined
Jun 12, 2017
Messages
905
So I have been playing around with my Menu form
I have removed all sub forms, removed all events. basically it is a blank form now
The DB still crashes
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 05:10
Joined
Sep 12, 2006
Messages
14,630
I assume something is trying to execute the call to the database window, and you don't have any error handling.

You can try to emulate it on your own PC by changing the dbs name/extension to .accdr, and see if you can track it down. I appreciate it's tricky as any unhandled error will crash access.
 

Gismo

Registered User.
Local time
Today, 07:10
Joined
Jun 12, 2017
Messages
905
I assume something is trying to execute the call to the database window, and you don't have any error handling.

You can try to emulate it on your own PC by changing the dbs name/extension to .accdr, and see if you can track it down. I appreciate it's tricky as any unhandled error will crash access.
🤦‍♂️🤦‍♂️🤦‍♂️

I TOTALLY MISED THIS
Call DoCmd.NavigateTo("acNavigationCategoryObjectType")
Call DoCmd.RunCommand(acCmdWindowHide)
Thank you
 

Gismo

Registered User.
Local time
Today, 07:10
Joined
Jun 12, 2017
Messages
905
How do I know get rid of this message?

1620127650385.png
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 05:10
Joined
Sep 12, 2006
Messages
14,630
You can't in a run time. It's advising you that there is code in the document, and because you have run time Access you can't set it as a trusted document. The user just just has to click OK/Open to accept it.

Look at it the other way - If there was a way to bypass this warning, you might easily introduce malware into your PC
 

Gismo

Registered User.
Local time
Today, 07:10
Joined
Jun 12, 2017
Messages
905
As I mentioned before, we are now using runtime and also, we have moved to google suite and removed the full version of office
How would I now export to google sheets instead of excel?

Not sure they thought of everything when they made this decision

The problem is, I still have full office package, if I change to a different way of handling this, will I be able to do the export

Below was the previous code

Private Sub ExcelOrderLineItems_Click()
On Error GoTo ExcelOrderLineItems_Click_Err



DoCmd.OutputTo acOutputQuery, "CS Order line Items Qry", "Excel97-Excel2003Workbook(*.xls)", "CS Orders - Line Items" & " - Registration -" & " " & Forms![CS Orders Detail - Main]![RegCBO] & ".xls", True, "", , acExportQualityPrint
ExcelOrderLineItems_Click_Exit:

Exit Sub

ExcelOrderLineItems_Click_Err:
MsgBox Error$
Resume ExcelOrderLineItems_Click_Exit
End Sub
 
Last edited:

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 05:10
Joined
Sep 12, 2006
Messages
14,630
If you can programme it in, you should be able to do it, and add it to a runtime version, but I have no idea if Access has inbuilt support for google forms. If you are using Office apps, then you ought to keep a full version of office, otherwise you can't support your databases at all
 

Users who are viewing this thread

Top Bottom