Check if Form is Open

I need to check to see if a form is open in the Onclose of another form.
And if it is to requery it, if not do nothing. I did find a Function on
The Access Web web site but I'm not sure how to utilize the function.

Function fIsLoaded(ByVal strFormName As String) As Integer
'Returns a 0 if form is not open or a -1 if Open
    If SysCmd(acSysCmdGetObjectState, acForm, strFormName) <> 0 Then
        If Forms(strFormName).CurrentView <> 0 Then
            fIsLoaded = True
        End If
    End If
End Function

I need to run this in the OnClose of a form to see if frmHome is open. I 
know
I need to pass the form name in the Function Arguments but not sure of
things after that.
Can someone please enlighten me?

James 

0
JamesJ
12/8/2007 9:37:58 PM
access.formscoding 7493 articles. 0 followers. Follow

2 Replies
1064 Views

Similar Articles

[PageSpeed] 4

"JamesJ" <jjy@adelphia_darwin.net> wrote in message 
news:ua6DMKeOIHA.4480@TK2MSFTNGP06.phx.gbl...
>I need to check to see if a form is open in the Onclose of another form.
> And if it is to requery it, if not do nothing. I did find a Function on
> The Access Web web site but I'm not sure how to utilize the function.
>
> Function fIsLoaded(ByVal strFormName As String) As Integer
> 'Returns a 0 if form is not open or a -1 if Open
>    If SysCmd(acSysCmdGetObjectState, acForm, strFormName) <> 0 Then
>        If Forms(strFormName).CurrentView <> 0 Then
>            fIsLoaded = True
>        End If
>    End If
> End Function
>
> I need to run this in the OnClose of a form to see if frmHome is open. I 
> know
> I need to pass the form name in the Function Arguments but not sure of
> things after that.
> Can someone please enlighten me?
>
> James

If fIsLoaded("frmHome") Then
    Forms!frmHome.ReQuery
End If


0
Stuart
12/8/2007 9:56:36 PM
Thanks

"Stuart McCall" <smccall@myunrealbox.com> wrote in message 
news:fjf3uo$5i$1$8300dec7@news.demon.co.uk...
> "JamesJ" <jjy@adelphia_darwin.net> wrote in message 
> news:ua6DMKeOIHA.4480@TK2MSFTNGP06.phx.gbl...
>>I need to check to see if a form is open in the Onclose of another form.
>> And if it is to requery it, if not do nothing. I did find a Function on
>> The Access Web web site but I'm not sure how to utilize the function.
>>
>> Function fIsLoaded(ByVal strFormName As String) As Integer
>> 'Returns a 0 if form is not open or a -1 if Open
>>    If SysCmd(acSysCmdGetObjectState, acForm, strFormName) <> 0 Then
>>        If Forms(strFormName).CurrentView <> 0 Then
>>            fIsLoaded = True
>>        End If
>>    End If
>> End Function
>>
>> I need to run this in the OnClose of a form to see if frmHome is open. I 
>> know
>> I need to pass the form name in the Function Arguments but not sure of
>> things after that.
>> Can someone please enlighten me?
>>
>> James
>
> If fIsLoaded("frmHome") Then
>    Forms!frmHome.ReQuery
> End If
>
> 

0
JamesJ
12/9/2007 10:31:02 PM
Reply:

Similar Artilces:

Recipe form
This is a multi-part message in MIME format. ------=_NextPart_000_0006_01CAA341.278E2830 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable I have a recipe database I am building or my wife. I have the categories = table and my recipes table with the relationshi set u between them. My wife would like a field on the recippe form displaying what number = recipe the item is within the category it is asigned to. For example if have 10 meat recipes and meatloaf is the fifth one, she = wants the number 5 display. I am asuming I n...

on last enter start new blank form
is there a way to have a new blank form start after entering last input of information? Thanks in advance for the help! If you set the form's property to add new records, and add a <Save> command button, you should get "a new blank form". If you're asking how to have it happen without the <Save> button, how will Access "know" when you're finished entering data? Regards Jeff Boyce Microsoft Access MVP -- Disclaimer: This author may have received products and services mentioned in this post. Mention and/or description of a produ...

check boxes
I would like to copy (hundreds) of check boxes in a spreadsheet. The checkbox must be assigned to a cell to work in a formula. When I copy the checkbox down however, all check boxes will either be checked, or unchecked. Is there a way to copy check boxes, when they are assigned to another cell, so that each check box can be used individually? I created the check boxes through the forms toolbar. Thanks for your help, this is a great forum and I only hope to give some day as much help as I am currently receiving! Hey, Mark- Things got busy yesterday, and I missed your post. You can t...

how to disable update links message when opening files
Hi I have approx 200 simple templates all of which are the same in layout, i'm using a simple macro which uses a loop to open each file pick up bits of info and lay it out on a list. The problem i have is some of these files have external links and when the macro opens them i get the message "Do i want to update links" which also pauses the macro until i click update or dont update. Is it possible to put a code within the macro which automatically selects dont update if a file has links. I've displayalerts = false but this doesnt seem to work thanks in ...

Outlook Express Attachments
I can receive attachments and see then on incoming emails, but can't click to open or save. Anyone had this problem? Cannot Open E-Mail Attachments in Outlook Express After You Install SP1 http://support.microsoft.com/?kbid=329570 OLEXP: Using Virus Protection Features in OLEXP 6 (OE removed access to the unsafe attachments in your email) http://support.microsoft.com/?kbid=291387 The articles will tell you to go to 'Tools|Options|Security' and remove the checkmark from the fourth box down, the one labeled "Do not allow attachments to be saved or opened that could potential...

Spell check on a protected sheet #2
Hi I think I've fixed it: Private Sub CommandButton1_Click() CommandButton1.TakeFocusOnClick = False ActiveSheet.Unprotect Password:="password" Cells.CheckSpelling MsgBox "Spell check complete. Press OK to continue" ActiveSheet.Protect Password:="password" End Sub I added the Message Box as if there are no spelling issues on the shee the users sees nothing happening when they press the button an naturally assumes its not worked. Thanks again for all your help Jon : -- jontai ----------------------------------------------------------------------- jonta...

checks cut on the fly #2
Hello: Great Plains needs to have the Detailed Trial Balance and SmartList Builder be able to pull in the check number for checks cut on the fly. This sort of enhancement really needs to be in the system. You see, the whole concept of checks cut on the fly eludes both the trial balance and even SmartList Builder. The reason for this is becuase checks cut on the fly area part of the PMTRX source document rather than the PMCHK source document that is reserved only for checks that are cut in a computer check run. Therefore, both types of checks are in separate tables and the table link...

Data input OK but form not dispalying information back
Hi I have created various forms and tables successfully but suddenly I have one form which is not behaving as i would expect. When I enter data into this form, it appears to have been saved in the table, however, when I exit the form and then go back in to check the data, it is no longer displayed. I am new to access and have been teaching myself as I go along. Obviously I am missing someting here. Can you help me please? Many Thanks-- Tash It is possible you may have changed the data entry properties for the form. I think that would be unlikely for a beginner. Check the properties ...

delete open inventory transfer
What sql command would you use to delete only OPEN inventory transfer in HQ, but not effect closed or partial transfer? Thanks Dave HI DCR, run the below query to accomplish your task. delete from purchaseorderentrydetail where purchaseorderentryid in (select id from purchaseorderentry where purchaseorderid in (select id from purchaseorder where POType between 2 AND 5 and status=0)) delete from purchaseorderentry where purchaseorderid in (select id from purchaseorder where POType between 2 AND 5 and status=0) delete from purchaseorder where POType between 2 AND 5 and status=0 I also ...

Edit Tabbed Forms
I made a database, and a form to enter info into the datatbase. The form has 2 tabs, but both tabs enter info in the same table. The problem is that when I go to open the form, it opens to the next entry, but the bottom record counter is at 1. I can't go back and edit past records. The report and the table shows all the records, but the form doesnt. Anyone know why? "Kevin" <Kevin@discussions.microsoft.com> wrote in message news:5F4D69AD-19B4-480A-A26E-1D6EA25372CA@microsoft.com... >I made a database, and a form to enter info into the datatbase. The form >has...

Global Template Message Pops Up When Opening Word 2007
I just made modifications to the Normal.dotm file in Word 2007. Everything seemed to be going well, up until I opened Word 2007 again. Now every time I start Word, a dialogue box appears with the following message: 'The Global template, NORMAL.DOTM, is already open as an add-in program'. My only option is to click on 'OK' and then it disappears. Does anyone know how to get rid of this message??? Sounds like you have a copy of Normal.dotm (or a shortcut to it) in the Word or Office Startup folder? -- Suzanne S. Barnhill Microsoft MVP (Word) Words into Ty...

Outlook Spelling Check
I have my Outlook in partition C:/ and my MS Office in partition D:/. Do I have to move the MS Office to C:/ to allow me to use spelling when I compose a message??? What version of Outlook are you using? Note: this group does not support Outlook Express. If you tried it and get errors, please report back the exact error message. --� Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. Due to the Swen virus, all e-mails sent to my actual account will be deleted w/out reading. After searching google.groups.com and finding no answer Jim <anonymou...

Credit Memo and Check Printing
My user wants the credit memo dollar amount printed on the check stub instead of zero dollars for credit memos like we currently have now. This way the vendor sees the posted the credit memo and for the agreed amount. I've been all over the setup options and there's nothing in Payables or Checkbooks that will print the actual dollar amount. Can this be done? Thanks, Sandy D'Anna Spectrum Financial Scottsdale, AZ If you apply the credit before you go into check printing selection it will not print on the stub, however if you apply the credit memo as part of the creation of th...

Is it possible to create and publish Outlook Custom Form through VBA
Hi All, I have created COM-Addin for Outlook in VB. But there are lot of limitations in VBScript like to handle all events(other than click event) of controls(ListView,Textbox) on outlook custom form. Can we handle these events using VBA so that i can distribute that application? Or Is it possible to create and publish that form through VB.? Thanks, Hi, Why don't you ask "Sue Mosher's" Forum - www.outlookcode.com - dedicated to OL add in programmers. -- Hope this helps you more Regards APK "ujwalabamishte@gmail.com" wrote: > Hi All, > I have created C...

Turn off Outlook spell checking of messages with vba
In developing an application for Word which sends e-mail messages using Outlook, I came across an issue that I have not been able to resolve. Hopefully someone will have a plan :) With Outlook's options configured to spell check the message before sending, each message processed creates the message 'Word finished checking the selection. Do you want to continue the remainder of the document' which requires user intervention. Clearly if the option is switched off in Outlook, the message doesn't occur. As I have no control over whether users have this option set o...

Auto-refresh Pivot Table upon opening
Over the past couple of days, I have been asking questions about a macro that auto-refreshes a pivot table upon opening it (meanwhile I have a macro that works). Yesterday I noticed that the Pivot Table options (Excel 2002) provides an option "refresh on open." Does selecting this option do exactly what I was looking for? Yes, the "Refresh on open" setting will do what you want, unless the worksheet is protected. If it is protected, you can run a macro when the workbook opens, to unprotect, refresh, and protect. K. Georgiadis wrote: > Over the past couple of da...

*** URGENT ***
Hi Folks, I need help. When I try to open a spreadsheet in Excel '97. It is telling me that the spreadsheet is already open and can not open twice. Please help me fix that problem. Thanks. Luc There are a couple of suggestions in the Excel FAQs shown here: http://www.contextures.com/xlfaqApp.html#AlreadyOpen Luc Aub� wrote: > I need help. When I try to open a spreadsheet in Excel '97. It is telling > me that the spreadsheet is already open and can not open twice. Please help > me fix that problem. -- Debra Dalgleish Excel FAQ, Tips & Book List http://www....

Use of check boxes in a database
Hi I'm hoping for some help in this. I have included the use of checkboxes in my database. So basically, if it's checked, it means yes. If not, it means no. The people who are using this database would like me to include the word yes or no adjacent to the checkboxes. I believe this is redundant but they're insistent on the inclusion. What do you think is the best way to deal with this question? Thank you in advance for your help. On Mon, 8 Mar 2010 21:03:01 -0800, forest8 <forest8@discussions.microsoft.com> wrote: >Hi > >I'm ho...

Quote Form
I am having a lot of difficulty doing modifications to the quote form beyond adding the company logo. I am using CRM 3.0, Outlook 2007, Word 2007. A couple of the issues are: 1) If disconnected from the domain (on laptop offline) can not connect to data source. 2) When on the network and select the quote table other fields indicate they are missing and Word wants to remove them. We are not interested in adding a 3rd party product and would really like to get this working with the tools provided in CRM. Has anybody had success with creating a nice custome quote form in Word, or am I wai...

#Deleted# records in Form
I've struggled with this before. It's been quite a while since I programmed in Access. When you delete a record from the source of a form, how do you get it to stop showing up as #Deleted#? I've tried Requery.... ?? TIA Ok, Crazy, Here is a function that will delete the current record and make that annoying #Deleted# disappear. If you have a Delete command button on the form, call it like this: DelCurrentRec(Me) I have this function is a Standard Module so I can call it from any form. Public Function DelCurrentRec(ByRef frmSomeForm As Form) Dim rst As Recordset O...

Checking what calls a workbook
Hello. I have been pointed in this Group's direction by another group... I currently use the following code to check if a workbook called Criticals_creator is calling the one that opens and run/not run a macro accordingly by forcing an error: Private Sub Workbook_Open() On Error GoTo IsClosed If Not Workbooks("Criticals_creator") Is Nothing Then Worksheets("RFQ").Activate Exit Sub End If IsClosed: Application.Visible = False WIP.Show End Sub Unfortunately, the workbook containing "RFQ" can also be called by a couple of VBA apps (from S...

Cannot open Outlook #9
I'm new to Outlook, and just got an e-mail account from my employer. After several futile minutes trying to find my inbox after signing in to office.microsoft.com, I thought I'd try finding it by opening Outlook. It was the first time I opened it, and I began filling in my e-mail info. I got to the questions about my ISP and other technical stuff and decided I was in over my head, so I hit Cancel. After reading up on how to fill that info in, I tried to reopen Outlook to enter the info, but instead it told me it couldn't access my default e-mail and shut down. I have th...

How can I open Internet Explorer8 window maximized?
I am using Window XP. Within an IE8 page, if I click a link, it will open a new window with small size. Is there a way to open it in full size? I try ctrl, or shift key to max it and exit it, but they did not work. Thank a lot. Chris Any window you want to resize permanently must be the /last/ window closed. Grab the corners of the window and drag it to full screen size. Do not use Maximize. Close all other windows first via the Taskbar and this one last. Windows will remember the *last* screen size used the next time you open the program. -- Bru...

Naming a subform from a main form
I'm having a heck of a time getting to a control on a sub form from a main form. I use the following convention Forms![frm MAIN_FORM]![frm SUB_FORM]![CONTROL_NAME] However when I run the code, I get an error message informing me Access cannot find the field named [frm SUB_FORM]. Then I tried taking the mainform out of the line leaving me with Forms![frm SUB-FORM]![CONTROL_NAME] Then the message reads can find find the form named frm subform. As far as I can tell the subform is opened. I can see it. I'm baffled. Can you help me? Common problem!! Open your main form in d...

cannot open shapes properties with Visio std 2007
Whatever I do (double-click, right click then go to properties, access the properties from the menu shape) I cannot open properties of any shape in Visio. Actually it's like Visio ignoring my action. very frustrating indeed. Any clue ? Thks, Franck On Sat, 29 Dec 2007 16:11:00 -0800, FT <FT@discussions.microsoft.com> wrote: >Whatever I do (double-click, right click then go to properties, access the >properties from the menu shape) I cannot open properties of any shape in >Visio. Actually it's like Visio ignoring my action. I wonder if it might be that the win...