Solved

Passing a flag between forms

Posted on 2011-09-11
3
335 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

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…
Not long ago I saw a question in the VB Script forum that I thought would not take much time. You can read that question (Question ID  (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_28455246.html)28455246) Here (http…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

776 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