473,756 Members | 2,900 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

URGENT - VBA Code to wait until Form Closes

21 New Member
I'm trying to complete some changes to a database that I have created and I need to finish it by tomorrow morning!

Here's the situation:

I have a form where people can order a number of products. They can set this form to varying statuses so that their supervisors can review the orders before they get placed. When the user (call them technicians) sets the order form to "review" status, the code goes through each individual item that they have ordered and checks to see if it has a serial number (thus making it a serialized item) because technicians need to enter additional information for all serialized equipment.

When it comes to a serialized item, the code opens up another form and goes to that specific items record so that the technician can edit the item-specific information.

Problem: I want the order form to cycle through these ordered items, but I need it to wait until they have closed that form that opens up for additional information before it continues on to the next item because sometimes there are multiple serialized items on one order.

Currently, it successfully goes through all of the items and identifies whether or not they are serialized items, but it goes through them all and opens up the same form for each serialized item before the user gets to put in data so it ends up with them only being able to enter data for the last serialized item.

Here is my current code:

Expand|Select|Wrap|Line Numbers
  1. Private Sub StatusID_AfterUpdate()
  2. If StatusID = 5 Then
  3.     lbSerials.Requery
  4.     For x = 0 To lbSerials.ListCount - 1
  5.         If lbSerials.Column(2, x) <> "" Then
  6.             MsgBox "You have selected a Serialized item that requires Production Information.", vbInformation, "Production Information Required"
  7.             DoCmd.OpenForm "Production", , , "[SerialNumber]= " & "'" & lbSerials.Column(2, x) & "'"
  8.  
  9. '<Need something here to make it wait?>
  10.  
  11.  
  12.         End If
  13.     Next x
  14. End If
  15.  
  16. End Sub
I use lbSerials as a listbox that pulls in the serial numbers for all of the products in the order form. Then the code checks the correct column (2) of the listbox for all serialnumbers.

Any help is much appreciated!

~Luke
Nov 12 '07 #1
4 21470
missinglinq
3,532 Recognized Expert Specialist
I believe when you open the second form, if you set the WindowMode parameter (I think it's the 6th argument) of the OpenForm command to acDialog Access will halt execution of the code until the second form is closed. acDialog sets Modal and Popup Properties to Yes and a form set to Modal, I believe, requires action and closing before other code continues.

Linq ;0)>
Nov 12 '07 #2
Luke Bailey
21 New Member
Perfect! Works like a charm. Thanks!
Nov 12 '07 #3
missinglinq
3,532 Recognized Expert Specialist
Glad we could help!

Linq ;0)>
Nov 12 '07 #4
ucobear
1 New Member
Thumb Up! Thank you. It helps me as well!
Mar 13 '14 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

28
5084
by: n00m | last post by:
When I double-click on "some.py" file console window appears just for a moment and right after that it's closed. If this script is started from inside of IDLE (F5 key) then it executes as it should be (e.g. executing all its print statements). Any ideas? OS: Windows; Python 2.3.4. Thanks.
8
1420
by: gremlinbass | last post by:
I was wondering if I can check to see if a file is open? Specifically, is there any way I can code Access to check to see if a text file (datasource.txt to be specific) is open, returning a true value and creating a loop? Then, once the file closes, return a false value and closing the loop? I need to run a batch file using Shell() and then run queries based on the text files that this batch files create. The catch is that the batch...
16
796
by: DJP | last post by:
Hi, I need to read a file programmatically until end of file. My logic is as follows: while(!feof(Fp)) { fgets(readLine,10000,Fp);
34
10805
by: Kovan Akrei | last post by:
Hi, I would like to know how to reuse an object of a thread (if it is possible) in Csharp? I have the following program: using System; using System.Threading; using System.Collections; public class A {
4
4987
by: Das | last post by:
Hi All, I want to have a link on the web form. On click it should print the web form. If I use javascript window.print then it displays the Title on the top of the page & URL at the bottom but i don't want any such thing. Is there any other method to print the complete form thanks in advance... das
6
1996
by: Anonymous | last post by:
Hello, I am loading a usercontrol with the LoadControl method and need to pass some data to the property of that control. How can I do that? THanks
232
13327
by: robert maas, see http://tinyurl.com/uh3t | last post by:
I'm working on examples of programming in several languages, all (except PHP) running under CGI so that I can show both the source files and the actually running of the examples online. The first set of examples, after decoding the HTML FORM contents, merely verifies the text within a field to make sure it is a valid representation of an integer, without any junk thrown in, i.e. it must satisfy the regular expression: ^ *?+ *$ If the...
4
11102
by: Eddie | last post by:
I am opening a windows (well, technically a greybox() call GB_show() which shows a nicer window than normal), and want to wait until that window is closed before moving to the next command. However, when I open the window, JavaScript immediately issues the next command statement. How can I get JavaScript to wait until the window is closed before continuing? Here's visually what I'm trying to do: statement1; GB_show('mycaption,...
6
2905
by: martin DH | last post by:
**Urgent Need** I'll throw out the basics and any assistance is very, very, very much appreciated! Access 2003 on XP On a form (frmMain) is an option group of check boxes (ReportFrame) from which a user can choose a specific report to generate. The user selects the report of choice then presses a comand button (CmdRunRpt). The command button runs using the code below: Private Sub CmdRunRpt_Click() If ReportFrame = 1 Then...
0
9456
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10034
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9872
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9713
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7248
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6534
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5304
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3805
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3358
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.