Hiding and Unhiding Forms In Code

A

Ayo

This is what I am trying to do. I hide a form and opened another form using a
button:
Me.Visible=False
DoCmd.Open "Select Report Type", acNormal

Now I want to unhide the form again using a button on the second form, I
tried:
If Forms![Inscope Site Summary].IsVisible=False Then
Forms![Inscope Site Summary].Visible=true
End If

But this didn't work. I am stuck. Any help will be greatly appreciated.
Thank you.
 
B

Beetle

Here is an example of using the IsVisible property (straight from your
friendly Access help file);

If Me!CategoryID.IsVisible Then
Me!Line0.Visible = True
Else
Me!Line0.Visible = False
End If

Notice how it is not followed by = True/False

However, I don't think the property applies to forms , so you should
probably just use;

If Forms![Inscope Site Summary].Visible=False Then

Forms![Inscope Site Summary].Visible=true

End If

Keep in mind that if you are ever working in the second form without the
first form being open, then this will throw an error. You can trap for that
using the IsLoaded property like;

If CurrentProject.AllForms([Inscope Site Summary]).IsLoaded = True Then

If Forms![Inscope Site Summary].Visible=False Then

Forms![Inscope Site Summary].Visible=true

End If

End If


HTH
 
A

Ayo

Thank you very much.

Beetle said:
Here is an example of using the IsVisible property (straight from your
friendly Access help file);

If Me!CategoryID.IsVisible Then
Me!Line0.Visible = True
Else
Me!Line0.Visible = False
End If

Notice how it is not followed by = True/False

However, I don't think the property applies to forms , so you should
probably just use;

If Forms![Inscope Site Summary].Visible=False Then

Forms![Inscope Site Summary].Visible=true

End If

Keep in mind that if you are ever working in the second form without the
first form being open, then this will throw an error. You can trap for that
using the IsLoaded property like;

If CurrentProject.AllForms([Inscope Site Summary]).IsLoaded = True Then

If Forms![Inscope Site Summary].Visible=False Then

Forms![Inscope Site Summary].Visible=true

End If

End If


HTH

--
_________

Sean Bailey


Ayo said:
This is what I am trying to do. I hide a form and opened another form using a
button:
Me.Visible=False
DoCmd.Open "Select Report Type", acNormal

Now I want to unhide the form again using a button on the second form, I
tried:
If Forms![Inscope Site Summary].IsVisible=False Then
Forms![Inscope Site Summary].Visible=true
End If

But this didn't work. I am stuck. Any help will be greatly appreciated.
Thank you.
 
A

Ayo

I got this error message:
"The expression you entered refers to an object that is closed or doesn't
exist"
I know the form wasn't closed because I use: Me.Visible=False to hide it and
all I want to do is unhide it again.
I used the code you suggested:

If CurrentProject.AllForms([Inscope Site Summary]).IsLoaded = True Then
If Forms![Inscope Site Summary].Visible=False Then
Forms![Inscope Site Summary].Visible=true
End If
End If


Beetle said:
Here is an example of using the IsVisible property (straight from your
friendly Access help file);

If Me!CategoryID.IsVisible Then
Me!Line0.Visible = True
Else
Me!Line0.Visible = False
End If

Notice how it is not followed by = True/False

However, I don't think the property applies to forms , so you should
probably just use;

If Forms![Inscope Site Summary].Visible=False Then

Forms![Inscope Site Summary].Visible=true

End If

Keep in mind that if you are ever working in the second form without the
first form being open, then this will throw an error. You can trap for that
using the IsLoaded property like;

If CurrentProject.AllForms([Inscope Site Summary]).IsLoaded = True Then

If Forms![Inscope Site Summary].Visible=False Then

Forms![Inscope Site Summary].Visible=true

End If

End If


HTH

--
_________

Sean Bailey


Ayo said:
This is what I am trying to do. I hide a form and opened another form using a
button:
Me.Visible=False
DoCmd.Open "Select Report Type", acNormal

Now I want to unhide the form again using a button on the second form, I
tried:
If Forms![Inscope Site Summary].IsVisible=False Then
Forms![Inscope Site Summary].Visible=true
End If

But this didn't work. I am stuck. Any help will be greatly appreciated.
Thank you.
 
J

Jeanette Cunningham

Ayo,
you need the quote marks around the name of the form in the isloaded
function
you can make the form visible if it is already visible without any error
(from memory)
If CurrentProject.AllForms("[Inscope Site Summary]").IsLoaded = True Then
Forms![Inscope Site Summary].Visible=true
End If

Jeanette Cunningham

Ayo said:
I got this error message:
"The expression you entered refers to an object that is closed or doesn't
exist"
I know the form wasn't closed because I use: Me.Visible=False to hide it
and
all I want to do is unhide it again.
I used the code you suggested:

If CurrentProject.AllForms([Inscope Site Summary]).IsLoaded = True Then
If Forms![Inscope Site Summary].Visible=False Then
Forms![Inscope Site Summary].Visible=true
End If
End If


Beetle said:
Here is an example of using the IsVisible property (straight from your
friendly Access help file);

If Me!CategoryID.IsVisible Then
Me!Line0.Visible = True
Else
Me!Line0.Visible = False
End If

Notice how it is not followed by = True/False

However, I don't think the property applies to forms , so you should
probably just use;

If Forms![Inscope Site Summary].Visible=False Then

Forms![Inscope Site Summary].Visible=true

End If

Keep in mind that if you are ever working in the second form without the
first form being open, then this will throw an error. You can trap for
that
using the IsLoaded property like;

If CurrentProject.AllForms([Inscope Site Summary]).IsLoaded = True Then

If Forms![Inscope Site Summary].Visible=False Then

Forms![Inscope Site Summary].Visible=true

End If

End If


HTH

--
_________

Sean Bailey


Ayo said:
This is what I am trying to do. I hide a form and opened another form
using a
button:
Me.Visible=False
DoCmd.Open "Select Report Type", acNormal

Now I want to unhide the form again using a button on the second form,
I
tried:
If Forms![Inscope Site Summary].IsVisible=False Then
Forms![Inscope Site Summary].Visible=true
End If

But this didn't work. I am stuck. Any help will be greatly appreciated.
Thank you.
 
A

Ayo

Thanks. I just tried it with the quotation marks and I still got the same
error message. i don't understand what is going on.

Jeanette Cunningham said:
Ayo,
you need the quote marks around the name of the form in the isloaded
function
you can make the form visible if it is already visible without any error
(from memory)
If CurrentProject.AllForms("[Inscope Site Summary]").IsLoaded = True Then
Forms![Inscope Site Summary].Visible=true
End If

Jeanette Cunningham

Ayo said:
I got this error message:
"The expression you entered refers to an object that is closed or doesn't
exist"
I know the form wasn't closed because I use: Me.Visible=False to hide it
and
all I want to do is unhide it again.
I used the code you suggested:

If CurrentProject.AllForms([Inscope Site Summary]).IsLoaded = True Then
If Forms![Inscope Site Summary].Visible=False Then
Forms![Inscope Site Summary].Visible=true
End If
End If


Beetle said:
Here is an example of using the IsVisible property (straight from your
friendly Access help file);

If Me!CategoryID.IsVisible Then
Me!Line0.Visible = True
Else
Me!Line0.Visible = False
End If

Notice how it is not followed by = True/False

However, I don't think the property applies to forms , so you should
probably just use;

If Forms![Inscope Site Summary].Visible=False Then

Forms![Inscope Site Summary].Visible=true

End If

Keep in mind that if you are ever working in the second form without the
first form being open, then this will throw an error. You can trap for
that
using the IsLoaded property like;

If CurrentProject.AllForms([Inscope Site Summary]).IsLoaded = True Then

If Forms![Inscope Site Summary].Visible=False Then

Forms![Inscope Site Summary].Visible=true

End If

End If


HTH

--
_________

Sean Bailey


:

This is what I am trying to do. I hide a form and opened another form
using a
button:
Me.Visible=False
DoCmd.Open "Select Report Type", acNormal

Now I want to unhide the form again using a button on the second form,
I
tried:
If Forms![Inscope Site Summary].IsVisible=False Then
Forms![Inscope Site Summary].Visible=true
End If

But this didn't work. I am stuck. Any help will be greatly appreciated.
Thank you.
 
B

Beetle

Actually, you should get rid of the brackets and the quotes and use
underscores between the words of the form name like this;

If CurrentProject.AllForms(Inscope_Site_Summary).IsLoaded = True Then

Sorry about that. I never use spaces when naming objects in my apps, so I
don't have to deal with brackets and underscores and such.

--
_________

Sean Bailey


Ayo said:
I got this error message:
"The expression you entered refers to an object that is closed or doesn't
exist"
I know the form wasn't closed because I use: Me.Visible=False to hide it and
all I want to do is unhide it again.
I used the code you suggested:

If CurrentProject.AllForms([Inscope Site Summary]).IsLoaded = True Then
If Forms![Inscope Site Summary].Visible=False Then
Forms![Inscope Site Summary].Visible=true
End If
End If


Beetle said:
Here is an example of using the IsVisible property (straight from your
friendly Access help file);

If Me!CategoryID.IsVisible Then
Me!Line0.Visible = True
Else
Me!Line0.Visible = False
End If

Notice how it is not followed by = True/False

However, I don't think the property applies to forms , so you should
probably just use;

If Forms![Inscope Site Summary].Visible=False Then

Forms![Inscope Site Summary].Visible=true

End If

Keep in mind that if you are ever working in the second form without the
first form being open, then this will throw an error. You can trap for that
using the IsLoaded property like;

If CurrentProject.AllForms([Inscope Site Summary]).IsLoaded = True Then

If Forms![Inscope Site Summary].Visible=False Then

Forms![Inscope Site Summary].Visible=true

End If

End If


HTH

--
_________

Sean Bailey


Ayo said:
This is what I am trying to do. I hide a form and opened another form using a
button:
Me.Visible=False
DoCmd.Open "Select Report Type", acNormal

Now I want to unhide the form again using a button on the second form, I
tried:
If Forms![Inscope Site Summary].IsVisible=False Then
Forms![Inscope Site Summary].Visible=true
End If

But this didn't work. I am stuck. Any help will be greatly appreciated.
Thank you.
 
A

Ayo

Thanks guys. I finally got it. Instead of ("[Inscope Site Summary]"), I used
("Inscope Site Summary"). Now it works. Thanks guys for all the help.

Ayo

Jeanette Cunningham said:
Ayo,
you need the quote marks around the name of the form in the isloaded
function
you can make the form visible if it is already visible without any error
(from memory)
If CurrentProject.AllForms("[Inscope Site Summary]").IsLoaded = True Then
Forms![Inscope Site Summary].Visible=true
End If

Jeanette Cunningham

Ayo said:
I got this error message:
"The expression you entered refers to an object that is closed or doesn't
exist"
I know the form wasn't closed because I use: Me.Visible=False to hide it
and
all I want to do is unhide it again.
I used the code you suggested:

If CurrentProject.AllForms([Inscope Site Summary]).IsLoaded = True Then
If Forms![Inscope Site Summary].Visible=False Then
Forms![Inscope Site Summary].Visible=true
End If
End If


Beetle said:
Here is an example of using the IsVisible property (straight from your
friendly Access help file);

If Me!CategoryID.IsVisible Then
Me!Line0.Visible = True
Else
Me!Line0.Visible = False
End If

Notice how it is not followed by = True/False

However, I don't think the property applies to forms , so you should
probably just use;

If Forms![Inscope Site Summary].Visible=False Then

Forms![Inscope Site Summary].Visible=true

End If

Keep in mind that if you are ever working in the second form without the
first form being open, then this will throw an error. You can trap for
that
using the IsLoaded property like;

If CurrentProject.AllForms([Inscope Site Summary]).IsLoaded = True Then

If Forms![Inscope Site Summary].Visible=False Then

Forms![Inscope Site Summary].Visible=true

End If

End If


HTH

--
_________

Sean Bailey


:

This is what I am trying to do. I hide a form and opened another form
using a
button:
Me.Visible=False
DoCmd.Open "Select Report Type", acNormal

Now I want to unhide the form again using a button on the second form,
I
tried:
If Forms![Inscope Site Summary].IsVisible=False Then
Forms![Inscope Site Summary].Visible=true
End If

But this didn't work. I am stuck. Any help will be greatly appreciated.
Thank you.
 
A

Ayo

Thanks.

Beetle said:
Actually, you should get rid of the brackets and the quotes and use
underscores between the words of the form name like this;

If CurrentProject.AllForms(Inscope_Site_Summary).IsLoaded = True Then

Sorry about that. I never use spaces when naming objects in my apps, so I
don't have to deal with brackets and underscores and such.

--
_________

Sean Bailey


Ayo said:
I got this error message:
"The expression you entered refers to an object that is closed or doesn't
exist"
I know the form wasn't closed because I use: Me.Visible=False to hide it and
all I want to do is unhide it again.
I used the code you suggested:

If CurrentProject.AllForms([Inscope Site Summary]).IsLoaded = True Then
If Forms![Inscope Site Summary].Visible=False Then
Forms![Inscope Site Summary].Visible=true
End If
End If


Beetle said:
Here is an example of using the IsVisible property (straight from your
friendly Access help file);

If Me!CategoryID.IsVisible Then
Me!Line0.Visible = True
Else
Me!Line0.Visible = False
End If

Notice how it is not followed by = True/False

However, I don't think the property applies to forms , so you should
probably just use;

If Forms![Inscope Site Summary].Visible=False Then

Forms![Inscope Site Summary].Visible=true

End If

Keep in mind that if you are ever working in the second form without the
first form being open, then this will throw an error. You can trap for that
using the IsLoaded property like;

If CurrentProject.AllForms([Inscope Site Summary]).IsLoaded = True Then

If Forms![Inscope Site Summary].Visible=False Then

Forms![Inscope Site Summary].Visible=true

End If

End If


HTH

--
_________

Sean Bailey


:

This is what I am trying to do. I hide a form and opened another form using a
button:
Me.Visible=False
DoCmd.Open "Select Report Type", acNormal

Now I want to unhide the form again using a button on the second form, I
tried:
If Forms![Inscope Site Summary].IsVisible=False Then
Forms![Inscope Site Summary].Visible=true
End If

But this didn't work. I am stuck. Any help will be greatly appreciated.
Thank you.
 

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