Edward Zuris
edzedz at comcast.net
Fri Jan 29 10:03:22 CST 2010
Thanks A.D. Tejpal,
I'll dig into your example.
By chance this is an Access 2000 application.
And thanks to everyone else for their ideas.
What I find interesting is that when the following
code is executed:
strVar = "Sure Add Task: Rake Yard"
lTmp1 = MsgBox(strVar, 4 + 256, strVar)
If lTmp1 = 7 Then
GoTo cmdTask_Click_End
End If
The VBA stop everything until the user responds.
Then depending on how the user/customer responds
the VBA code can be commanded to do different things.
When I try to emulate the same with a modal form
the calling VBA script keep marching along.
My current work-around is:
strVar = "Sure Add Task: Rake Yard"
If gInteractive = True Then
lTmp1 = MsgBox(strVar, 4 + 256, strVar)
If lTmp1 = 7 Then
GoTo cmdTask_Click_End
End If
End If
The current work-around has the disadvantage of
adding code to someone else's work.
Once again thanks to all for all the suggestions
and help.
Thanks.
Sincerely,
Ed Zuris.
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of A.D. Tejpal
Sent: Thursday, January 28, 2010 9:51 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] In a legacy system how control a Vba MsgBox
Ed,
If there are compelling reasons to enforce automated closing of
message box, my sample db named Form_MsgBoxAutoClick might be of
interest to you. It is in access 2000 file format and is available at
Rogers Access Library. Link -
http://www.rogersaccesslibrary.com/forum/forum_topics.asp?FID=45
This sample db demonstrates automatic closing of message box after a
specified time delay (which can be set as desired), if the user fails to
respond in the given time span. It makes use of API calls FindWindow and
DestroyWindow via temporary activation of form's timer. On closing the
message box, form's timer gets automatically disabled.
An alternative solution based upon SendKeys is also demonstrated -
just for academic interest (Main solution based upon API calls is to be
preferred).
Best wishes,
A.D. Tejpal
------------
----- Original Message -----
From: Edward Zuris
To: accessd at databaseadvisors.com
Sent: Friday, January 29, 2010 01:09
Subject: [AccessD] In a legacy system how control a Vba MsgBox
Dear AccessD Forum
I am doing a little automation work within a legacy
environment.
From inside some VBA code, a form is opened, given some
data, where buttons and controls are clicked.
The opened form, ft001CreateTasks, has a MsgBox asking
a Yes/No question.
What kind of handle do I use to click the YES button
on the message box modal form ?
Or are there some other way of tackling this issue ?
Thanks.
Sincerely,
Ed Zuris.
====================================================
Example Vba Code snippet
====================================================
strVar = ""
DoCmd.OpenForm "ft001CreateTasks", , , strVar
strVar = "Rake Yard"
Forms("ft001CreateTasks").cboTaskType.Value = strVar
Call Forms("ft001CreateTasks").cboTaskType_Click
. . . . now a message box open on the form . . . . .
====================================================
====================================================
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com