stefania nj <(E-Mail Removed)> wrote in
news:0d240472-1e36-4de9-81d7-(E-Mail Removed)
:
> If u.dbCount = 1 Then
> DoCmd.Close , "frmMain"
> End If
What about
DoCmd.Close acForm, “frmMain”
It shouldn’t be required to specify the default argument (acForm is
the default), but maybe it makes a difference in the context in
which you’re doing this.
One thought about something that’s not clear. If the form you’re
running the above code in was called from frmMain, it may be that
you can’t close the calling form.
Going back to your other routine:
If u.dbCount = 1 Then
DoCmd.OpenForm "frmDatabase"
Else
DoCmd.Maximize
End If
....if that’s running in frmMain, you might do this:
If u.dbCount = 1 Then
DoCmd.OpenForm "frmDatabase"
DoCmd.Close acForm, Me.Name
Else
DoCmd.Maximize
End If
....instead of in the OnOpen event of frmDatabase. That way you
elminate any problems caused by closing the calling form.
--
David W. Fenton
http://www.dfenton.com/
contact via website only
http://www.dfenton.com/DFA/