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 VBA
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA 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 August 26th, 2004, 06:31 PM
Registered User
 
Join Date: Aug 2004
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Determine if a form is open

I have a main form (Form1) to enter information into table1. One field is linked to table2. TO add information to table2 you can click on a macro button in form1 to open a new form (form2) to add information to table2. After you enter your information into form2 and click on the close button the linked information in Form1 is not updated. you can not see the information that you just added. I have added code into form2's close button to refresh form1. That works as long as form1 is open. Is there a way to add a if then else statment to determine if form1 is open. something like. if (form1 is open) then refresh form1 else close form. Any help will be GREAT!!

Thanks in advance

Reply With Quote
  #2 (permalink)  
Old October 7th, 2004, 04:59 PM
Authorized User
 
Join Date: Oct 2003
Location: Cleveland, OH, USA.
Posts: 75
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Have your code call a function named IsFormOpen - the call would
look something like this:

If IsFormOpen("form_name") = True Then ...
   your_code_goes_here
End If

Declare a public function named IsFormOpen() - here's the code:

Public Function IsFormOpen(ByVal strObjectName As String) As Boolean

    If SysCmd(acSysCmdGetObjectState, acForm, strObjectName) = acObjStateOpen Then
       If Forms(strObjectName).CurrentView = 1 Then
          IsFormOpen = True
       Else
          IsFormOpen = False
       End If
    End If

End Function
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
Open one form or the other mean34dean Access VBA 4 August 21st, 2008 12:02 PM
Close all MdiChield form from open one form/Button salman .NET Framework 2.0 6 December 10th, 2007 03:21 AM
Close all MdiChield form from open one form salman .NET Framework 1.x 0 November 8th, 2007 12:32 AM
Open Form, run query, open form Grafixx01 Access 7 April 26th, 2007 11:32 AM
determine if an invisibile form is open Loralee Access 12 February 25th, 2006 09:07 PM



All times are GMT -4. The time now is 09:03 PM.


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