Hi All,
Below is my code, everything works okay but frmLogOn remains open. I do not
want to make it Visible = Flase because closing it later on causes other
issues. I want it to close when the frmMainMenu opens. The event below is
from the frmMainMenu.
Private Sub Form_Load()
'On Load of the switchboard check for probationary periods
Dim intProbation As Integer
Dim intTemp As Integer
Dim intHire As Integer
Dim intYearOne As Integer
intTemp = Nz(DCount("First90Days", "qryNewEmployee", "First90Days
>=Date()"), 0)
intHire = Nz(DCount("Second90Days", "qryNewEmployee", "Second90Days
>=Date()"), 0)
intYearOne = Nz(DCount("FirstYear", "qryNewEmployee", "FirstYear >=Date()"),
0)
intProbation = intTemp + intHire + intYearOne
If intProbation = 0 Then
Exit Sub
Else
If MsgBox(intProbation & " Employee(s) ready to be hired
in " & _
vbCrLf & "and/or have been here for 1 year. " & _
vbCrLf & "Do you want to view them now?", _
vbYesNo, "Probation") = vbYes Then
DoCmd.Minimize
DoCmd.OpenForm "frmNewEmployee", acNormal
Forms("frmLogOn").SetFocus 'nothing happens
DoCmd.Close acForm, "frmLogOn" 'nothing happens
Else
Exit Sub
End If
End If
End Sub
Thanks for any and all help...
Gina Whipp
jahoobob - 27 Jun 2006 19:40 GMT
You shouldn't need the line before you close frmLogOn
>Hi All,
>
[quoted text clipped - 39 lines]
>Thanks for any and all help...
>Gina Whipp
jahoobob - 27 Jun 2006 19:43 GMT
Added: I believe that when you SetFocus to the frmLogOn you lose the focus
of you Sub and thus it stops, never reaching the Close.
>You shouldn't need the line before you close frmLogOn
>
[quoted text clipped - 3 lines]
>>Thanks for any and all help...
>>Gina Whipp
Gina Whipp - 27 Jun 2006 19:51 GMT
Doesn't matter whether that line is is there or not, the form does not
close.
> You shouldn't need the line before you close frmLogOn
>
[quoted text clipped - 45 lines]
>>Thanks for any and all help...
>>Gina Whipp
jahoobob - 27 Jun 2006 20:16 GMT
This code is running in frmLogOn, right. If it is then try deleting the
DoCmd.Minimize and just use DoCmd.Close No need to name the form from code
in the form.
>Doesn't matter whether that line is is there or not, the form does not
>close.
[quoted text clipped - 4 lines]
>>>Thanks for any and all help...
>>>Gina Whipp
Gina Whipp - 27 Jun 2006 20:51 GMT
No this code is running on frmMainMenu.
> This code is running in frmLogOn, right. If it is then try deleting the
> DoCmd.Minimize and just use DoCmd.Close No need to name the form from
[quoted text clipped - 9 lines]
>>>>Thanks for any and all help...
>>>>Gina Whipp