Can't get frmLogOn to close - Please Help...

G

Gina Whipp

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
 
J

jahoobob via AccessMonster.com

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.

Gina said:
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]
 
G

Gina Whipp

No this code is running on frmMainMenu.

jahoobob via AccessMonster.com said:
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.

Gina said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top