Question Locked

Microsoft Access

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

hello i need a bit of help - i have got a menu form on acces that has buttons to open other forms and reports, how do i make it that when i click a button the menue form closes? and when i exit the other forms/reports the menue form returns?? think i need to put in some VB code - not sure if it is simpler though.
thanks

3 replies

by jdmercha

But I think you have the right idea. I think that you can only do one action on a button click, unless you add some vb code.

You probably need to add something in the code like:
docmd.closeform.formname
docmd.openform.formname.

Then on the other for add something to the section like:
docmd.openform.formname.

by gearybish

There are many ways you could do this.
You might try frmMainMenu.Visible = False in the command button for opening the form. Then in the OnClose event of the form use

If IsLoaded("frmMainMenu") Then
If frmMainMenu.Visible = False Then
frmMainMenu.Visible = True
End If
End If

Function IsLoaded _
(ByVal strFormName As String) As Boolean
'Returns True if the specified form
'is open in Form view or Datasheet view.

Const conObjStateClosed = 0
Const conDesignView = 0

If SysCmd(acSysCmdGetObjectState, _
acForm, strFormName) <> _
conObjStateClosed Then
If Forms(strFormName).CurrentView _
<> conDesignView Then
IsLoaded = True
End If
End If

End Function

This discussion is closed to new replies.