G
Guest
I’m looking for the most efficient way to allow only form or one report open
at a time. For example, in a database which has three forms: If the user
tries to open FormC, a function(?) checks to see if FormA or FormB are open
and, if so, closes the open form and then opens FormC. I would have a similar
function for reports.
I’m assuming a function is the best way to handle this, but I’d like one
which doesn’t require having to hard code the names of each form (or report)
in the database.
I should point out that all forms and reports are accessible only through a
custom toolbar. So, the best method might be to put the name of the function
[e.g., =CheckForm()] in the On Action event of each button or menu which
opens a form.
Here’s the general idea:
###
Function CheckForm()
If [any form but the one you’re trying to open].IsLoaded = True Then
DoCmd.Close acForm, “[the form which is loaded]â€
DoCmd.OpenForm "[name of form you’re trying to open]"
Else
DoCmd.OpenForm "[name of form you’re trying to open]"
End If
End Function
###
Thanks.
Kurt
at a time. For example, in a database which has three forms: If the user
tries to open FormC, a function(?) checks to see if FormA or FormB are open
and, if so, closes the open form and then opens FormC. I would have a similar
function for reports.
I’m assuming a function is the best way to handle this, but I’d like one
which doesn’t require having to hard code the names of each form (or report)
in the database.
I should point out that all forms and reports are accessible only through a
custom toolbar. So, the best method might be to put the name of the function
[e.g., =CheckForm()] in the On Action event of each button or menu which
opens a form.
Here’s the general idea:
###
Function CheckForm()
If [any form but the one you’re trying to open].IsLoaded = True Then
DoCmd.Close acForm, “[the form which is loaded]â€
DoCmd.OpenForm "[name of form you’re trying to open]"
Else
DoCmd.OpenForm "[name of form you’re trying to open]"
End If
End Function
###
Thanks.
Kurt