Solved

Modal Window Response

Posted on 2011-02-19
12
346 Views
Last Modified: 2012-08-14
Is there a way to act on the response from a model window? I want to fire a subroutine if the repsonse is 'OK' and bypass one it is 'Cancel.
0
Comment
Question by:ChuckRush
  • 4
  • 4
  • 2
  • +2
12 Comments
 
LVL 6

Expert Comment

by:AkAlan
Comment Utility
The vbYesNo option can be changed, just type and intellisense will give you the options

Dim confirm As VbMsgBoxResult
  confirm = MsgBox("Are you sure you want to do that?", vbYesNo, "Message goes here")
   
        If confirm = 6 Then
         
              'Run Subroutine here        Else
         Else
               'Do something else here
        End If
0
 
LVL 92

Expert Comment

by:Patrick Matthews
Comment Utility
Certainly:



Dim Msg As Long

Msg = MsgBox("Prompt", vbOKCancel, "Title")
If Msg = vbOK Then
    'do something
Else
    'do something else
End If

Open in new window

0
 
LVL 75

Expert Comment

by:DatabaseMX (Joe Anderson - Access MVP)
Comment Utility
It's pretty much just one line of code ....

If MsgBox("Prompt", vbOKCancel, "Title") = vbOk Then Call YourFunctionName ()

mx
0
 

Author Comment

by:ChuckRush
Comment Utility
Ty I understandx thaT but I am wanting to act on the response in the window that called the modal window
0
 
LVL 92

Expert Comment

by:Patrick Matthews
Comment Utility
MX and I show how to do just that.  Where is it that you're getting hung up?
0
 
LVL 75

Expert Comment

by:DatabaseMX (Joe Anderson - Access MVP)
Comment Utility
<patrick ... did you end up buying a book?>

mx
0
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
LVL 92

Expert Comment

by:Patrick Matthews
Comment Utility
Yes, I did.  Will update that later :)
0
 
LVL 75

Expert Comment

by:DatabaseMX (Joe Anderson - Access MVP)
Comment Utility
Curious to know which book ... stopping by another B&N later today.
Summit ?
0
 
LVL 6

Accepted Solution

by:
Gugro earned 250 total points
Comment Utility
Usually I use a global var which will get its value from the modal window. e.g.

DoCmd.OpenForm "MyForm", ,,acDialog
if frmRetVal = 'xxx' then ...

where MyForm sets the value in OnClose:

Private Sub OnClose(...)
  frmRetVal = "xxx"
End Sub
0
 

Author Closing Comment

by:ChuckRush
Comment Utility
Thanks I got to that myself -- sort of had a brain shutdown
0
 
LVL 75

Expert Comment

by:DatabaseMX (Joe Anderson - Access MVP)
Comment Utility
ChuckRush
What does that have to do with the MsgBox ?

mx
0
 
LVL 92

Expert Comment

by:Patrick Matthews
Comment Utility
>>Summit ?

Of course :)
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
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…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

763 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

7 Experts available now in Live!

Get 1:1 Help Now