473,406 Members | 2,387 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

URGENT - VBA Code to wait until Form Closes

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 21415
missinglinq
3,532 Expert 2GB
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
Perfect! Works like a charm. Thanks!
Nov 12 '07 #3
missinglinq
3,532 Expert 2GB
Glad we could help!

Linq ;0)>
Nov 12 '07 #4
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
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...
8
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...
16
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
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; ...
4
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...
6
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
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...
4
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. ...
6
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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...
0
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,...
0
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...

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.