?
Solved

Passing a flag between forms

Posted on 2011-09-11
3
Medium Priority
?
349 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 48

Accepted Solution

by:
Martin Liss earned 2000 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 48

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Over the years I have built up my own little library of code snippets that I refer to when programming or writing a script.  Many of these have come from the web or adaptations from snippets I find on the Web.  Periodically I add to them when I come…
Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month14 days, 12 hours left to enroll

771 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