Procedure Problem

D

David Whitaker

I started on a very small form for a popup from the main form to enter data
for 1 field instead of using an input box, I like this better, but I have
one issue, how do you get the popup form to finish the rest of the code on
the main form from which it was opened from?
The popup form opens from a procedure from within a frame option box that
when change is seen it ask for data and hides/shows a few boxes and labels
on the main form. When the popup is canceled, I can reset the value of the
option box on the main form to its original value, but there are other
things like calculations, and show/hide boxes that need to be dealt with
when the value changes back.
Below is a segment of the code which opens the popup from the option box

If IsNull(Me.year2) Then
bytchoice = MsgBox("Would You Like To Set The Year For This Column",
vbYesNo, "New Year Activation")
If bytchoice = vbYes Then
'this is the popup
DoCmd.OpenForm ("year2")
End If
If bytchoice = vbNo Then
Me.Frame128.Value = Me.Frame128.OldValue
MsgBox "This Column Was Not Activated", , "Canceling Procedure"
Exit Sub
End If
End If
'I would like to enter here and finish all of the code from here down
If Me.year3 <> 0 Then
MsgBox "There is Data in the 3rd Years Employees History, Please
Delete it Before Continuing", vbOKOnly, "Verifying Year Selection Change"
Me.Frame128.Value = Me.Frame128.OldValue
Exit Sub
End If
'more code follows from this point
 
G

Guest

The key is to open the form modally. This halts execution in your code, and forces the user to either close the form, or have your code at least hide the form by setting the .Visible property to false.

Example:
Docmd.OpenForm "frmForm",,,,,acdialog

David
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top