Hi all,
I Have a problem keeping the focus on a form.
When my database generates an error I have an Error handler wich opens a form showing the error details.
This all works fine, but because the form loads from the line below it takes the focus back after runnung the code and hides the error form behind the form wich generated the error.
This is the function wich creates the error text and opens the errormessage form (frmFoutmelding)
I've tried to hide the form from the error form but this doesn't work either.
Anyone have an idea how to solve this?
I Have a problem keeping the focus on a form.
When my database generates an error I have an Error handler wich opens a form showing the error details.
This all works fine, but because the form loads from the line below it takes the focus back after runnung the code and hides the error form behind the form wich generated the error.
Code:
Exit_Form_Open:
6 Exit Sub
Err_Form_Open:
7 FoutMelding Err.Source, "Form_Open", Erl, Err.Number, Err.Description, Me.Name
8 Resume Exit_Form_Open
Code:
Function FoutMelding(stSource As String, stProcedure As String, intRegel As Integer, dblFoutnummer As Double, stFoutmelding As String, Optional stForm As String)
1 On Error GoTo Err_FoutMelding
2 DoCmd.OpenForm "frmFoutmelding", , , , , , stForm
3 Forms!frmFoutmelding!txtFoutmelding = _
"Foutnummer: " & dblFoutnummer & vbCrLf _
& "Foutomschrijving" & vbCrLf & stFoutmelding & vbCrLf _
& "--------------------------------------------" & vbCrLf _
& "DataBase : " & stSource & vbCrLf _
& "Formulier: " & stForm & vbCrLf _
& "Procedure: " & stProcedure & vbCrLf _
& "Regel: " & intRegel
Exit_FoutMelding:
4 Exit Function
Err_FoutMelding:
5 MsgBox "Foutmelding: " & Err.Description, vbCritical, "Fout: " & Err.Number
6 Resume Exit_FoutMelding
End Function
I've tried to hide the form from the error form but this doesn't work either.
Anyone have an idea how to solve this?