Wrox Programmer Forums
BOOK: Access 2007 VBA Programmer's Reference ISBN: 978-0-470-04703-3
This is the forum to discuss the Wrox book Access 2007 VBA Programmer's Reference by Teresa Hennig, Rob Cooper, Geoffrey L. Griffith, Armen Stein; ISBN: 9780470047033
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Access 2007 VBA Programmer's Reference ISBN: 978-0-470-04703-3 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old August 22nd, 2007, 12:23 AM
Registered User
Join Date: Aug 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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


Similar Threads
Thread Thread Starter Forum Replies Last Post
chapter 13 - MVC omarosa BOOK: Professional PHP 5 ISBN: 978-0-7645-7282-1 10 March 25th, 2009 12:00 AM
Chapter 13 bwoll BOOK: Beginning Access 2003 VBA 1 June 7th, 2007 03:57 PM
Chapter 13 ElMorenito BOOK: Beginning ASP 3.0 0 January 14th, 2005 02:56 PM

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