Solved

Passing a flag between forms

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

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 45

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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…
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…

708 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now