UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Docmd.close Minimizes Access Window, Any Version    
 
   
BenHe
post May 27 2020, 05:16 AM
Post#1



Posts: 3
Joined: 26-February 20



I close a PopUp via
DoCmd.Close ObjectType:=acForm, ObjectName:=Me.Name
Sometimes, and always after a restart, this command not only closes the current popUp Form, but also minimzes the Access Windows.

There is no minimization animation, you can just reopen Access in the Taskbar.
I already had this problem with other popUps but found workarounds.

Here is the full code:
Private Sub cmdSchliessenUndSpeichern_Click()
On Error GoTo errorHandler
If Me.idtblAngebote <> "" Then

GlobaleVariablen.strAngebotsID = Me.idtblAngebote
Else
GlobaleVariablen.strAngebotsID = ""
End If
DoCmd.Close ObjectType:=acForm, ObjectName:=Me.Name
errorHandler:
If Err.Number <> 0 Then
MsgBox ("Es wurde kein Angebot zur Buchung hinzugefügt, da ein Fehler aufgetretten ist --- " & Err.Description)
Err.Raise (Err.Number)
End If
End Sub

No error is raised, the error occures, even when all the other code is commented out.
I cannot recreate the error in debugging mode, because that way you dont see the Access Window anyway.
Go to the top of the page
 
dashiellx2000
post May 27 2020, 07:54 AM
Post#2


UtterAccess VIP
Posts: 9,864
Joined: 11-March 05
From: Maryland


It doesn't appear you have a way to "exit" the sub if an error is not raised. I would also suggest being more explicit with your error handling naming.

CODE
Private Sub cmdSchliessenUndSpeichern_Click()
On Error GoTo cmdSchliessenUndSpeichern_Click_Error
If Me.idtblAngebote <> "" Then
     GlobaleVariablen.strAngebotsID = Me.idtblAngebote
Else
     GlobaleVariablen.strAngebotsID = ""
End If
DoCmd.Close ObjectType:=acForm, ObjectName:=Me.Name

cmdSchliessenUndSpeichern_Click_Exit:
Exit Sub

cmdSchliessenUndSpeichern_Click_Error:
     If Err.Number <> 0 Then
          MsgBox ("Es wurde kein Angebot zur Buchung hinzugefügt, da ein Fehler aufgetretten ist --- " & Err.Description)
          Err.Raise (Err.Number)
     End If
     Resume cmdSchliessenUndSpeichern_Click_Exit
End Sub

--------------------
William
“We're run by the Pentagon, we're run by Madison Avenue, we're run by television, and as long as we accept those things and don't revolt we'll have to go along with the stream to the eventual avalanche"
Go to the top of the page
 
BenHe
post Jun 3 2020, 06:25 AM
Post#3



Posts: 3
Joined: 26-February 20



Thank you very much. thanks.gif
This solved my issue.
Go to the top of the page
 
BenHe
post Jun 22 2020, 09:36 AM
Post#4



Posts: 3
Joined: 26-February 20



Unfortunately, I have to recognise that my problem was not solved.

Access still minimizes for no appearend (to me) reason.
This is the way i open the form.

CODE
DoCmd.OpenForm "PopUpAngebotsauswahl", , , , , acDialog


I actually "solved" the issue, because the focus goes back to the main form when i throw a message box
So directly after the first line

CODE
msgbox("You have choosen x")


Just curious why my misstake occures?

Ben
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    4th July 2020 - 10:24 AM