Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 9th, 2003, 05:44 PM
Authorized User
 
Join Date: Jun 2003
Location: , , .
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default How do I Unhide a Form?

I am using two different forms to open a third form. For simplicity, lets say FormA and FormB have buttons to open FormC.

Here is the problem. When I open FormC from either FormA or FormB, the first Form is hidden:

    [code from FormA]
    DoCmd.OpenForm "FormC", acNormal, , "Key=Forms!FormA.Key"
    Forms!FormA.Visible = False
and
    [code from FormB]
    DoCmd.OpenForm "FormC", acNormal, , "Key=Forms!FormB.Key"
    Forms!FormB.Visible = False

That part is simple enough but the problem comes when I close FormC. How do I unhide the appropriate form?

When I use the following code, I get error if FormC was opened from FormB:

    Forms!FormA.Visible = True

Any help would be appreciated.
__________________
-Shay Shepston
Reply With Quote
  #2 (permalink)  
Old June 10th, 2003, 06:55 AM
Friend of Wrox
Points: 4,007, Level: 26
Points: 4,007, Level: 26 Points: 4,007, Level: 26 Points: 4,007, Level: 26
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Lansing, Michigan, USA.
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

Quote:
quote:Originally posted by shepston
When I use the following code, I get error if FormC was opened from FormB:

    Forms!FormA.Visible = True
How about not explicitly hiding FormA or FormB? If you open FormC and maximize it, there is no need to hide the calling form. It'll be hidden behind FormC anyway. And when you close FormC, the calling form will be right there. No need to unhide it.


Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
Reply With Quote
  #3 (permalink)  
Old June 10th, 2003, 11:02 AM
Authorized User
 
Join Date: Jun 2003
Location: , , .
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default

That is a good idea but because of layout issues, it cannot be maximized.



***EDIT***
I was able to stretch and resize this form to cover the other form but it does not look clean since the form is only has a few lines. This puts the footer of the form on the bottom of the screen.

I would still like to find a way to unhide the other forms.
Reply With Quote
  #4 (permalink)  
Old June 10th, 2003, 11:46 AM
Friend of Wrox
Points: 4,007, Level: 26
Points: 4,007, Level: 26 Points: 4,007, Level: 26 Points: 4,007, Level: 26
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Lansing, Michigan, USA.
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

Quote:
quote:Originally posted by shepston
 That is a good idea but because of layout issues, it cannot be maximized.
 Ah, then consider one of these two options.

1) FormC is a small form. Why not set its modal property and Pop-Up properties to YES. Set its border style to DIALOG. You would not hide the calling form, it would still be visible but it will be behind FormC. Because of the three latter settings I mentioned, users will not be able to click outside of FormC until they fill it out and click OK or CANCEL. In this way, FormC is a pop-up box people fill out. No need to hide the calling form.

2) If you STILL want to hide the calling form, on the button that opens FormC, set a global variable in the OnClick event. For example gstrCallerForm = "FormA" (or "FormB"). Then in FormC when it gets closed, the last item on FormC's OnClose Event will be
Code:
   If gstrCallerForm = "FormA" Then
      Forms.FormA.Visible = True
   Else
      Forms.FormB.Visible = True
   End If
Given the size and purpose of FormC, my preference would be option 1. Option 2 would leave a lot of "naked" space around FormC that I would not like. Especially if that naked space exposes the tables, queries, or whatever happens to be under both Forms A and C (or B and C).

Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
Reply With Quote
  #5 (permalink)  
Old June 10th, 2003, 11:57 AM
Registered User
 
Join Date: Jun 2003
Location: Lakewood, WA, USA.
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Add the following code to a new module. This procedure provides you a means of determining if a form is open.

Public Function IsLoaded(strFormName As String) As Boolean
' Returns True if the specified form is open in Form view or Datasheet view. ' Comments : Determines if the named form is open ' Parameters: strFormName - form to check for
' Returns : True - form is open, False - form is not open
 '
    IsLoaded = (SysCmd(acSysCmdGetObjectState, acForm, strFormName) <> 0)

End Function

On the button on FormC that closes FormC and opens FormA or FormB add the following.

    If IsLoaded("FormA") Then
        DoCmd.OpenForm "FormA"
    ElseIf IsLoaded("FormB") Then
        DoCmd.OpenForm "FormB"
    End If

    DoCmd.Close acForm, "FormC"


John Ruff - The Eternal Optimist :-)
Reply With Quote
  #6 (permalink)  
Old June 10th, 2003, 01:26 PM
Authorized User
 
Join Date: Jun 2003
Location: , , .
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Solution 2 from Greg and John's solution work just as I need. Thanks for giving me 2 to chose from!

Thanks for you help guys.


-Shay Shepston
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to set a form as startup form in vb.net 2.0 mallikalapati .NET Framework 2.0 1 February 21st, 2008 09:19 AM
How to refresh owner form on closing of child form akumarp2p C# 2005 0 December 22nd, 2006 10:27 AM
Converting an HTML Form to ASP.Net Form k_alidxb75 ASP.NET 1.x and 2.0 Application Design 0 November 30th, 2006 03:26 AM
hide/unhide columns in datagrid drachx ADO.NET 1 March 26th, 2005 01:46 PM
Page refresh, Back Button unhide hidden division John K. King Javascript 13 April 12th, 2004 03:00 AM



All times are GMT -4. The time now is 08:53 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.