473,609 Members | 1,818 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

custom message box

Hi Gurus

I am trying to make a custom message box with a dialog form.

Here is how I would like to do it:
1- anywhere in the database, in any procedure, I call the function that
opens a dialog form
2- users clicks on a button in the custom form
3- answer from user is passed back to original procedure (e.g. whether
the answer was Yes or No).

I can do all of this but I can not pass the answer (the click of a button)
back to the original function (3).

Any suggestions?

Thank you

Nicolaas
Nov 13 '05 #1
7 15251
WindAndWaves wrote:
Hi Gurus

I am trying to make a custom message box with a dialog form.

Here is how I would like to do it:
1- anywhere in the database, in any procedure, I call the function that
opens a dialog form
2- users clicks on a button in the custom form
3- answer from user is passed back to original procedure (e.g. whether
the answer was Yes or No).

I can do all of this but I can not pass the answer (the click of a button)
back to the original function (3).

Any suggestions?

Thank you

Nicolaas

I think I might be a bit simplistic here but perhaps this is all you need:

Dim Response as int

Response = Msgbox("Ask user a question",vbYes No,"TestMsg")

IF Response = vbYes then

'Do stuff

Else

'Do sumfin else

end if

OR THIS WORKS TOO*******

IF Msgbox("Ask user a question",vbYes No,"TestMsg") = vbYes then

'Do stuff

Else

'Do sumfin else

end if
Nov 13 '05 #2
On Wed, 23 Jun 2004 11:14:23 +1200, "WindAndWav es" <ac****@ngaru.c om> wrote:
Hi Gurus

I am trying to make a custom message box with a dialog form.

Here is how I would like to do it:
1- anywhere in the database, in any procedure, I call the function that
opens a dialog form
2- users clicks on a button in the custom form
3- answer from user is passed back to original procedure (e.g. whether
the answer was Yes or No).

I can do all of this but I can not pass the answer (the click of a button)
back to the original function (3).

Any suggestions?

Thank you

Nicolaas


A dialog form will halt all code execution (except code in the dialog form itself) until the form is closed or hidden.
The method I use for returning a value from a dialog form is to hide the form rather than close it. This will allow code
execution to continue in the calling routine, but the values from the hidden dialog form are still available. Your
calling function grabs the value(s) it needs from the dialog and then closes the form.
eg
DoCmd.OpenForm "frmMyDialo g", , , , , acDialog
'code execution stops here

'when the dialog form is hidden execution resumes
vSomeVariable = Forms!frmMyDial og!SomeControl

'now close the dialog form
DoCmd.Close acForm, "frmMyDialo g"

The code behind your "Close" button on the dialog form would be -
Me.Visible = False
Wayne Gillespie
Gosford NSW Australia
Nov 13 '05 #3
Do you know you can easily do this with a messagebox:

Dim MsgStr As String
DimTitleStr As String
MsgStr = "My Message"
TitleStr = "Caption of Messagebox"
If MsgBox(MsgStr,v bYesNo,TitleStr ) = vbYes Then
<Do This>
Else
<Do That>
End If

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdata sheet.com
www.pcdatasheet.com

"WindAndWav es" <ac****@ngaru.c om> wrote in message
news:B4******** ***********@new s.xtra.co.nz...
Hi Gurus

I am trying to make a custom message box with a dialog form.

Here is how I would like to do it:
1- anywhere in the database, in any procedure, I call the function that
opens a dialog form
2- users clicks on a button in the custom form
3- answer from user is passed back to original procedure (e.g. whether
the answer was Yes or No).

I can do all of this but I can not pass the answer (the click of a button)
back to the original function (3).

Any suggestions?

Thank you

Nicolaas

Nov 13 '05 #4
I have done it with a message box in the past, but I am fussy and I do not
like the look of a message box (unless you know a way to change that).

Thank you
Nov 13 '05 #5
Hi Wayne

Thank you for that answer. That is very smart. It is quite unexpected
that:
a. you can hide a dialog form
b. code resumes when you hide it

Great solution.
Nov 13 '05 #6
"WindAndWav es" <ac****@ngaru.c om> wrote in message
news:B4******** ***********@new s.xtra.co.nz...
Hi Gurus

I am trying to make a custom message box with a dialog form.

Here is how I would like to do it:
1- anywhere in the database, in any procedure, I call the function that opens a dialog form
2- users clicks on a button in the custom form
3- answer from user is passed back to original procedure (e.g. whether
the answer was Yes or No).

I can do all of this but I can not pass the answer (the click of a button)
back to the original function (3).


When you open your custom dialog form do so using the acDialog windowmode
option.

DoCmd.OpenForm "frmMessageBox" , acNormal, , , , acDialog

This causes the code in the calling routine to halt. When the user clicks
OK, (or Yes No or whatever), don't close the form - just hide it. This
allows the calling routine to continue. Since the message box form is still
open you can now read the value selected, (by setting a text box on the form
to receive the user selection for example). Now your calling code can close
the dialog.

In fact there's no requirement to close it - you could just leave it open
and hidden, and it will appear as normal the next time it's called.
Nov 13 '05 #7
thank you all for your help, i now have a great custom message box in
operation....
Nov 13 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
2088
by: One Handed Man \( OHM - Terry Burns \) | last post by:
When using a custom control. In order to check and see if values have changed one has to implement the IPostBackDataCollection interface. The values returned for the control seem to be simply a string with comma delimited values. For example, if I were to render two text boxes. One with the Value Terry and the Other with the Value 'Burns' I would get the following value Terry,Burns.
6
2829
by: Nick Horrocks | last post by:
I have set up a custom error page for 404 errors. However the HTTP status code returned is 302 followed by 200, this causes search engines not to remove old pages from their index. How can I get the correct status code to be returned? Thanks
7
2911
by: Adam | last post by:
Im trying to add an httphandler for all *.sgf file extensions. I have developed the handler, 1. installed it into the gac 2. added it to the machine.config: <httpHandlers> <add verb="*" path="*.sgf" type="CustomExtensionHandler, Extenders.CustomExtensionHandler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d831d925597c1031" validate="True"/> </httpHandlers>
5
2526
by: Graham | last post by:
I have created a custom MembershipProvider called "LassieMembershipProvider" that derives from "MembershipProvider". This providor is located in a Businesslogic layer dll called "Enlighten.LinkMad.Businesslogic". In one of my frontend websites I use this type to authenticate a user who is trying to login. The following excerpt is from the web.config of the particular site showing the reference to the custom provider, allowing .Net to do...
2
2578
by: Suzanne | last post by:
Hi all, I'm reposting this message as I'm experiencing this problem more and more frequently : I really hope someone out there can help me as I've been tearing my hair out on this one for a good while and I'm getting really frustrated now! My problem is this - my custom controls periodically disappear from my
6
1576
by: Steve Amey | last post by:
Hi all I want to be able to throw a custom error up the call stack. I have looked around and it seems as though it's possible, but I can't get it to work :o( Below is some sample code. ------------------------------------------------------------ Public Class MainForm Public Sub Show Form Try
15
6505
by: rizwanahmed24 | last post by:
Hello i have made a custom control. i have placed a panel on it. I want this panel to behave just like the normal panel. The problem i was having is that the panel on my custom control doesnt accept other controls. The control i drag drop on it becomes the child of my custom control's parent form and not the child of my custom control. Then i added this line "" before my custom control class (i dont know what this line does). Now
2
19448
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I will be writing this article intended for those who are in the same level, or maybe lower, of my technical knowledge. I would be using layman's words, or maybe, my own words as how I understand them, hoping, you will understand it the same way that...
1
4376
by: asharda | last post by:
I have a custom property grid. I am using custom property grid as I do not want the error messages that the propertygrid shows when abphabets are entered in interger fields. The custom property grid doesn't show colloections i.e. if I have a List<Objectthen the Collection is shown but when I click on the "..." button next to it nothing comes up. If I say CustomPropertyGrid p = new CustomPropertyGrid(); p.SelectedObject = new...
0
2897
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I will be writing this article intended for those who are in the same level, or maybe lower, of my technical knowledge. I would be using layman's words, or maybe, my own words as how I understand them, hoping, you will understand it the same way that...
0
8133
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8083
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8547
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8224
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7013
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4026
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2535
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1676
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1393
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.