p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Access 2007 VBA Programmer's Reference ISBN: 978-0-470-04703-3 (http://p2p.wrox.com/forumdisplay.php?f=329)
-   -   Chapter 13 - Forms as objects (http://p2p.wrox.com/showthread.php?t=61376)

Zave August 22nd, 2007 12:23 AM

Chapter 13 - Forms as objects
I am trying to use this code , and I cannot get the code in the calling form to wait for the dialog form to return the values so I can use them. It immediately runs all the code, does the Case Else statement and only then switches to the dialog form. I set the dialog form as modal, but that does not help.
Here is the calling code:
This is in the declaration section

Option Compare Database
Option Explicit
Private WithEvents dlg As Form_dlgMyDialog
Public VarReturn1 As Variant
Public VarReturn2 As Variant
Private Sub dlg_finished(VarReturn1 As Variant, VarReturn2 As Variant)
VarReturn1 = VarReturn1
VarReturn2 = VarReturn2

End Sub

This is in the command button:
Private Sub cmdselect_click()
Set dlg = New Form_dlgMyDialog
dlg.Visible = True
    Select Case varReturn1
  Case 1
    DoCmd.OpenReport stDocName, acPreview, , "Not tblMiscDetails.txtMechanech='ú'"

    Case 2
    DoCmd.OpenReport stDocName, acPreview, , "tblMiscDetails.txtMechanech= 'ú'"
    Case 3
    DoCmd.OpenReport stDocName, acPreview
  Case Else
  MsgBox "Wrong Choice"
  End Select


All times are GMT -4. The time now is 09:52 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.