Solved

Passing a flag between forms

Posted on 2011-09-11
3
337 Views
Last Modified: 2012-05-12
My application has a data entry form with a “RETURN” command button that unloads the form and returns the user to the main “dashboard”.

Before those actions are allowed to execute, the data is sanity checked. I do this by showing a form frmSanityCheck that performs five sanity checks and displays the results on-screen. I have a public boolean variable bSanity that is set to “True” if the data passes the sanity checks, “False” otherwise.

Data Entry Form;

Sub cmdReturn_Click()
frmSanityCheck.Show
If bSanity = True Then
Unload Me
End If
End Sub

Open in new window


Sanity Check Form:

Sub Form_Load()
	bSanity = True
‘---
‘--- do the checks
‘--- possibly setting bSanity = False
‘---
End Sub

Sub cmdReturn_Click
‘ Returns to Data Entry Form
Unload Me
End Sub

Open in new window


Question: How does the cmdReturn sub in the Entry Form know to wait for frmSanityCheck to unload before checking the value of bSanity?

Is there a better way to do this?


0
Comment
Question by:NormaPosy
  • 2
3 Comments
 
LVL 46

Accepted Solution

by:
Martin Liss earned 500 total points
ID: 36520797
If you when you load frmSanityCheck you load it modally with frmSanityCheck.Show vbModal, nothing can be done until that form is unloaded.
0
 
LVL 46

Expert Comment

by:Martin Liss
ID: 36520803
That should have said

If when you load frmSanityCheck...
0
 

Author Closing Comment

by:NormaPosy
ID: 36520865
Thank you so much.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question