Open a new form and closing the old form - a potential problem for referenced field?

I have two forms which are both popups.  After the first one is displayed 
the user clicks on the the listbox on the form and in the on click event the 
second form is opened and the first form closes itself in succession..

DoCmd.OpenForm "secondform"
DoCmd.Close acForm,"firstform"

The thing is the query in the second form references the list box in the 
first form for a value.  So far it works fine in testing but I was concerned 
whether the first form could close too fast before the second form is able 
to excute its query which references the first form.

Robert 



0
Robert
12/22/2007 3:53:13 PM
access.forms 6864 articles. 2 followers. Follow

4 Replies
704 Views

Similar Articles

[PageSpeed] 43

Robert wrote:
> I have two forms which are both popups.  After the first one is
> displayed the user clicks on the the listbox on the form and in the
> on click event the second form is opened and the first form closes
> itself in succession..
> DoCmd.OpenForm "secondform"
> DoCmd.Close acForm,"firstform"
>
> The thing is the query in the second form references the list box in
> the first form for a value.  So far it works fine in testing but I
> was concerned whether the first form could close too fast before the
> second form is able to excute its query which references the first
> form.
> Robert

You could use...

DoCmd.OpenForm "secondform"
Me.Visible = False

....and then use code in the second form to close the first.  I'm pretty sure 
that if you use the Load event that the query will have been done running by 
that point.  If not then the Timer event could be used.

Another alternative would be to leave the first form open but hidden.  If you 
close it and the user (or your code) tries to refresh or requery the second form 
you will get an error.  By leaving the first form open you avoid that.  You 
could then close the first form in the Close event of the second.

-- 
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt   at   Hunter   dot   com 


0
Rick
12/22/2007 3:57:59 PM
I don't think this will be a problem. The reference is already made and will
hold until the procedure, i.e. the first form closing and the query loading
the second form, is complete. This is true regardless of how many records are
retrieved by the query.

-- 
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000/2003

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-forms/200712/1

0
Linq
12/22/2007 7:29:26 PM
I see what you are saying.  The second form's query must start, not finish, 
before the first form is closed.  Is it even possible for the first form to 
close before the second form starts its query?  Would other users make a 
difference?

"Linq Adams via AccessMonster.com" <u28780@uwe> wrote in message 
news:7d14b29f3a0c1@uwe...
>I don't think this will be a problem. The reference is already made and 
>will
> hold until the procedure, i.e. the first form closing and the query 
> loading
> the second form, is complete. This is true regardless of how many records 
> are
> retrieved by the query.
>
> -- 
> There's ALWAYS more than one way to skin a cat!
>
> Answers/posts based on Access 2000/2003
>
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/Forums.aspx/access-forms/200712/1
>
> 



0
Robert
12/23/2007 6:02:59 AM
Thanks.
"Rick Brandt" <rickbrandt2@hotmail.com> wrote in message 
news:iuabj.598$El5.299@newssvr22.news.prodigy.net...
> Robert wrote:
>> I have two forms which are both popups.  After the first one is
>> displayed the user clicks on the the listbox on the form and in the
>> on click event the second form is opened and the first form closes
>> itself in succession..
>> DoCmd.OpenForm "secondform"
>> DoCmd.Close acForm,"firstform"
>>
>> The thing is the query in the second form references the list box in
>> the first form for a value.  So far it works fine in testing but I
>> was concerned whether the first form could close too fast before the
>> second form is able to excute its query which references the first
>> form.
>> Robert
>
> You could use...
>
> DoCmd.OpenForm "secondform"
> Me.Visible = False
>
> ...and then use code in the second form to close the first.  I'm pretty 
> sure that if you use the Load event that the query will have been done 
> running by that point.  If not then the Timer event could be used.
>
> Another alternative would be to leave the first form open but hidden.  If 
> you close it and the user (or your code) tries to refresh or requery the 
> second form you will get an error.  By leaving the first form open you 
> avoid that.  You could then close the first form in the Close event of the 
> second.
>
> -- 
> Rick Brandt, Microsoft Access MVP
> Email (as appropriate) to...
> RBrandt   at   Hunter   dot   com
>
> 



0
Robert
12/23/2007 6:03:50 AM
Reply:

Similar Artilces:

when i open an attachment it just shows a box i cannot open
Attachment, whether docs or pictures won't open. I can preview them inside the window pane, but then have to copy to word doc to print. Should be able to open attachment and then print just from there. Please help. It's like the Microsoft Picture manager is working strangely. ...

code to allow edits in form AND subform
Ok, here goes............. I have a form (frmBOL) which contains a subform (sfrmData). I have this code working to allow the form to be edited, but I can't seem to incorporate the subform into it. Everything I try gives me an error. Can anyone help? Private Sub cmdOK_Click() Dim sPassword As String sPassword = Nz(Me.txtPassword.Value, "") ' if it is a valid password, we let them edit the ' form that called this form. The calling form is ' responsible for check that the current user is ' either the QA tech on the record, or a me...

Opening a paramater form when open a report
I have a repor that takes date parameters from a seperate form.. As it is now I have to open the form put in the paramaters and then run the report which is based on a query... I would like to have the form pop up when I open the report and then close once once the report has run.. Help Please And thanks in advance bob On Wed, 15 Aug 2007 11:56:00 -0700, Bob wrote: > I have a repor that takes date parameters from a seperate form.. As it is now > I have to open the form put in the paramaters and then run the report which > is based on a query... > > I would like to ...

New Certificate problems
Our scenario We have been running with SBS 2003 for several years and our Certificate is pop3.olddomainname.co.uk (where our old domain name is now changing) For one reason or another, we've never got it qualified to DNS,, and with only 2 of us accessing OWA, we just use https://<external_IP>/exchange and our PDA's could get email OK on the move. Now, we have built a linux box to run the support part of our website, we have a new external domain, so we got support.newdomainname.co.uk added to DNS We need the PDA/iPhone to use SSL so that they and OWA use the 443 po...

How do I get my MS Pub 2000 to open Pub files from Pub 2003?
i cannot get my Publisher 2000 to open files from Pub 2003....do i have to buy Pub 2003? or is there a solution that I can download? I have already disabled my antivirus and that didn't do anything.. also my files are not "read only". pls help. thx. Novice Novice <Novice@discussions.microsoft.com> was very recently heard to utter: > i cannot get my Publisher 2000 to open files from Pub 2003....do i > have to buy Pub 2003? or is there a solution that I can download? I > have already disabled my antivirus and that didn't do anything.. also > my files ...

Publisher 2000
After I open the Publisher 2000 program and attempt to open a file or create a new document, I get the message "Microsoft Publisher 2000 Version 6.0 has encoountered a problem and needs to close. WE are sorry for the inconvenience". I tried repairing the program and even reinstalling it, but that did not correct it. Suggestions? If you are trying to use Publisher on a network - don't it is not intended for a network Publisher files have to be worked on and saved to the local hard drive ONLY. -- Hi tom (tevanz@bellsouth.net), in the Microsoft� newsgroups you posted: ...

opening links in outlook
why i can not open links attached to my e-mails mike wrote: >why i can not open links attached to my e-mails > I think you did some mistake in typing so just do one thing first type the link in notepad and then direct copy and paste that in your mail. -- Stellar Information Systems Ltd. D18, Sector-33, Infocity Phase II, Gurgaon-122001 Phone : (0124) 326 6069, 432 6700 Website : http://www.stellarinfo.co.in/ What happens when you try? Do you get the error; "This operation has been cancelled due to restrictions in effect on this computer" See http://www.m...

Outlook Mail Editor Does Not Close When Outlook Closes
Config: WIN2K & Outlook 2K with latest service packs. Word is my email editor. When I close Outlook the WINWORD.EXE process continues to run. (There are no open email messages when I close Outlook.) If I subsequently open Word it will not to print because it says a default printer does not exist. If I stop the WINWORD.EXE process in the Task Manager before launching Word it prints fine. I couldn't find an applicable Knowledge Base article for this. Any help is greatly appreciated. Geary ...

Perpetually new messages
Hello, One of the people I work with has a weird problem. Every time she checks her messages, the ones currently in her inbox show up as new. They appear to be downloaded a second time, and then the duplicates disappear, leaving the new items only. I think that the mailbox may be corrupted because there the mailbox has some extra numbers appended to it. Any help would be appreciated. Thanks! Jeff ...

Save as comma csv problems
Hello, I hace Excel 2002. I have near 6000 addresses and contacts and wish to save the xls to a comma csv. I have done that before and then imported the comma csv into my membership program were it says 'import comma csv'. The problem is that some (300 odd) of the records are not imported correctly. I think this maybe because here are some commas in some of the fields eg 24 my street, whatever. Would that be the cause, and if so how can I get rid of all the commas? Many thanks rock I bet it's the way that your membership program works. I'd try this against a copy ...

Problem trying to open old money file
Hi, I am trying to open a four-month old money file, which was on my backup disk. It is a *.mny file, not a backup file. It was created using the same version of Money (2005) which I still use. When I start MS MONEY and try open my old data file, it tells my that it wants convert my file so it works with this version. (Not sure why as the file was created in this version of MS Money). Then when I try and carry out the conversion it gives the following error message. "Money cannot locate xxxx or cannot open it, possibly because it is a read-only file or you do not have...

Running Virus Scan Slowing down opening files
3 minutes to open files in excel and word Are you using kaspersky virusscan? It is know for it. If yes please ask you administrator to exclude scan on harddisk or network files in the settings. -- Arien ------------------------------------------------------------------------ Arien's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=1892 View this thread: http://www.excelforum.com/showthread.php?threadid=390878 All Virus Scanning can be stopped: If your using Norton Follow the below if you want to open documents much faster Open Norton Click on: Norton Interne...

Adding a new Interface in MS CRM
Hi, I don't want to use the "Add Lead" form to create a lead. I have developed my own page for this using the MS CRM APIs. But I have to change the linked page of "Leads" link in the left menu ( Sales) and point to my custom page. How can I do this? Thanks, -Jaison Well this is a little different as you will have to recreate the outer shell of CRM. We did this using the ASP.NET controls from Infragistics for one of our clients. Sean "Jaison" <jaison@netgalactic.com> wrote in message news:OCDt3caaEHA.4032@TK2MSFTNGP11.phx.gbl... > Hi, > >...

Email with tiny attachments open slow
Good Day All, I am using Exchange server 200 and Outlook 2003 mail client. I have started to experience with a single machine where all of a sudden reading emails with attachments of any size, even 6k, slows greatly. Just selecting the email item in the list takes at least 30 seconds before the lower pane shows the body of the selected item. No other client has the same problem even while this machine does. The problem seems to disappear at some point and then returns. The machine was connected to a 10Mbps switch so I changed to a 100Mbps switch and Event logs reveal nothing. I have ...

why is outlook closing when I try to maximise window?
Just started using Microsoft outlook 2000 for emails. Was using web based programmes before. Outlook express wouldn't recognise internet connection, so went to MS Outlook. After a lot of adjustments, finally got it to send and recieve however when it opens, it is in a minimized window. Every time I click the maximize button or try to expand the borders by clicking and dragging, it closes and gives me a message that outlook needs to close. Why is it doing that and how can I get it to open in a maximized window. ...

Need an open house sign in sheet
Need an open house sign in sheet That's interesting, but do you have a question about Publisher? -- James Bart: "According to creationism, there were no cavemen." Homer: "Well good riddance, their drawings sucked and they all looked like hippies!" "soozeeque" <soozeeque@discussions.microsoft.com> wrote in message news:1096B15B-9766-4573-9FC2-2053BEC1F34B@microsoft.com... > Need an open house sign in sheet I would suggest keeping it simple. Use a table for the visitors' information and maybe your real estate company's logo...

CRM4: IIS 7.0 on Win2k8
Hi all, I'm using the following code on entity's OnLoad event to load a JavaScript file: =================================== function LoadFile(url, cache) { var httpRequest = new ActiveXObject('Msxml2.XMLHTTP'); httpRequest.open('GET', url, false); if (!cache) httpRequest.setRequestHeader('If-Modified-Since', 'Sat, 1 Jan 2000 00:00:00 GMT'); httpRequest.send(null); return httpRequest.responseText; } LoadFile('/ISV/COMPANY/script.js', false) =================================== I am accessing CRM using Web Client from the ser...

cannot open excel file from outlook
Excel 2007 cannot open document eithout first saving and opening thru excel Try to re-register Excel. Close Excel first and On the Windows Taskbar Start>Run "excel.exe /regserver"(no quotes)>OK. See the space between exe and /regserver You might have to designate a full path to excel.exe. In that case Start>Run "C:\yourpath\excel.exe" /regserver(quotes required)>OK Gord Dibben MS Excel MVP On Wed, 27 Jan 2010 11:38:12 -0800, Rick <Rick@discussions.microsoft.com> wrote: >Excel 2007 cannot open document eithout first savi...

opening links
Whenever I try to open a link in Outlook XP -- (Win XP Pro) it opens a "open with" prompt/box. Point it to the .exe for your preferred browser and click okay. --� 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 anonymous@discussions.microsoft.com <anonymous@discussions.microsoft.com> asked: | Whenever I try to open a link in Outlook XP -- (Win XP | Pro) it opens a "open with&quo...

unable to open your default mail folders...
I am running XP Pro and Office XP 2002. I currently use Outlook express on this PC but want to switch over to Outlook. When I try to open Outlook I get the message- Unable to open your default mail folders. Could not open item. Try again. Any ideas what's going on ??? Thanks in advance!!! -- Dennis Have you created a mail profile and installed your mail account(s)? -- Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. ALWAYS post your Outlook version. How to ask a question: http://support.microsoft.com/KB/555375 After furious head scrat...

Workbook always opens at a specific sheet and cell
I have a workbook consisting of many sheets. How do I make sure that everytime I open the work book, it would directly point to a specific sheet and cell? Hi put the following code in your workbook module (not in a standard module). sub workbook_open() me.worksheets("sheetx").activate end sub -- Regards Frank Kabel Frankfurt, Germany Zee wrote: > I have a workbook consisting of many sheets. How do I make sure that > everytime I open the work book, it would directly point to a specific > sheet and cell? methinks the original poster also wanted to activate a particu...

Exported form shows error
I exported a table and form to another database for use in another facility I operate. When I go to open the form, an error is displayed stating..."The record source '~sq_cSaidTable~sq_cList70' specified on this form or report does not exist" It then proceeds to alter the record souce in the form in design veiw. I have done that and the error persists. How do I repair this? -- Deltadog-Sacramento River Delta fisher extrodinairre... ...

EXCEL Files open Slow
Why is it that when I open associated files for Office 2007 (.xlsx and ..docx) that they open SLOW (approx 15 seconds). However, if I have Excel or Word open and then attempt to open specific files, they open in a snap ? I have Office 2007, Vista Home Prsmium, a 2.4 Quad Core system, and four gigs of ram. Can someone please explain this and help me out ? Thanks. Hi, If I get your point - when you open the files in the Window Explorer (outside of Excel) it takes longer. Sometimes that if because Excel needs to launch, and that can be slower than just opening a file from inside of Excel...

update many fields in a form from existing info.
I have 2 tables. One table stores various information about companies including company name, address, etc. The second table stores student names. In a form, I am able to enter mutiple student names into a memo field and, as of right now, type in the company name, address, etc. (it is not linked to the company name table at all). What I want to do is this: from the student add form, search the company table for a company based on partial name and/or zipcode, select one company from a possible 1 or more companies, and have the fields in the form automatically fill in - pulling the ...

Problem with outlook 2003 stop information store in exchange 5.5 s
In my scenario my mail server is exchange 5.5 server enterprise...Two weeks ago all my clients was outlook 2000 , but we have been migrating to outlook 2003.The issue starts after the change.....several clients stop working and in my exchange server 5.5 the information store service stop with a Dr Watson popup.The problem is just the same as the exposed in KB834466 .... Any idea to solve this issue?? Anyone with the same problem??? thanks.... There is a known issue with Outlook 2003 connecting to Exchange 5.5. You must have 818709 installed or you will crash your store. Installing this hotf...