Minimize form using Menu

G

Guest

Hi,

I have a navigation page with drop down menu. When my user select from the
drop down menu a form will open based on what the user had selected. When
the user selected the form from the drop down menu I want the navigation to
either closed or minimize how do i do that. I seen something like:
Docmd.close acform, me.name. but where would I put the code so there is no
bug. Below is my code on navigation page. Thank you so much.

Private Sub Combo6_AfterUpdate()
If Me.Combo6 = "Brea Products" Then
DoCmd.OpenForm "Brea Products"
End If
If Me.Combo6 = "Chaska Products" Then
DoCmd.OpenForm "Chaska Products"
End If
If Me.Combo6 = "Miami Products" Then
DoCmd.OpenForm "Miami Products"
End If
End Sub
 
G

Guest

Hi,

If you want your form to close every time, then put it immediately before
the end sub.

Damian.
 
G

Guest

I would have to disagree with Damian, I have found that if you open a form,
and then use the DoCmd.Close command, it closes the form you just opened.

There are 2 solutions that I'm aware of:
1.) Define a string and use it to store the information from your combo box,
Immediately after you assign the value to the string, use DoCmd.Close then
run your if or case questions off of it.
2.) Once you have opened your new form, you will need to reference the
initial form by defining it as acForm and then by name, not by "me".

Examples:
1.)
Private Sub Combo6_AfterUpdate()
Dim strForm as string

strForm = Me.Combo6
DoCmd.Close
Select Case strForm 'this can replace all of those if statements
Case "Brea Products"
DoCmd.OpenForm "Brea Products"
Case "Chaska Products"
DoCmd.OpenForm "Chaska Products"
Case "Miami Products"
DoCmd.OpenForm "Miami Products"
End Select
End Sub

2.)
Select Case me.combo6
Case "Brea Products"
DoCmd.OpenForm "Brea Products"
Case "Chaska Products"
DoCmd.OpenForm "Chaska Products"
Case "Miami Products"
DoCmd.OpenForm "Miami Products"
End Select
DoCmd.Close acForm, "FormName"
end sub

Where "FormName" is the name of the form containing your initial combo box.

I hope that helps!
 
G

Guest

Just re-read your post...if your preference is to minimize, try this:

Private Sub Combo6_AfterUpdate()
Dim strForm as string

strForm = Me.Combo6
DoCmd.Minimize
Select Case strForm 'this can replace all of those if statements
Case "Brea Products"
DoCmd.OpenForm "Brea Products"
Case "Chaska Products"
DoCmd.OpenForm "Chaska Products"
Case "Miami Products"
DoCmd.OpenForm "Miami Products"
End Select
End Sub
 
G

Guest

Tim, Thank you so much. It works perfectly:)

Tim Johnson said:
Just re-read your post...if your preference is to minimize, try this:

Private Sub Combo6_AfterUpdate()
Dim strForm as string

strForm = Me.Combo6
DoCmd.Minimize
Select Case strForm 'this can replace all of those if statements
Case "Brea Products"
DoCmd.OpenForm "Brea Products"
Case "Chaska Products"
DoCmd.OpenForm "Chaska Products"
Case "Miami Products"
DoCmd.OpenForm "Miami Products"
End Select
End Sub
 
G

Guest

Tim one more thing,

If I am not not using a combo menu how would I open a form and minimized
(navigation form) I clicked on? What would the code be and which form do I
place the code in? thanks.
 
G

Guest

Glad the code worked.

I'm not quite sure I understand your question, are you looking for ways to
open a new form without using your combo box idea, or are you trying to
return to the original navigation form via the form you opened with the combo
box?
 
G

Guest

Hi Tim,

On the navigation page I also have buttons that when I click will open a
form. What I want to do is when the user click on the button in my
navigation page the form opens and the navigation form minimizes. How do it
code this and which form and where in the form do i put the code? Thanks.
 
G

Guest

Hi Tim,

I figures it out. Thanks.

E-mail report using Lotus Notes rather t said:
Hi Tim,

On the navigation page I also have buttons that when I click will open a
form. What I want to do is when the user click on the button in my
navigation page the form opens and the navigation form minimizes. How do it
code this and which form and where in the form do i put the code? Thanks.
 

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