473,883 Members | 1,788 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 21482
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
5103
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
1427
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
10843
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
4992
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
2000
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
13417
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
11110
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
2921
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
9942
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
9792
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11142
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...
1
10848
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9575
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7972
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
7130
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();...
2
4221
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3234
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.