Download as pdf or txt
Download as pdf or txt
You are on page 1of 15

MS Access: Enhanced Message Box Replacement

Tuesday, May 20, 2008

This project provides a custom and enhanced message box replacement for the default MsgBox found in Access. A Test database for Access 2007 is available at the bottom of this post. (Updated Tuesday 17MAR2009.)

Whats wrong with the default MsgBox


The default message box in Access is sometimes useful to warn, inform or ask confirmation from the user.

It has, however, a few drawbacks: It is bland: the standard message box does not even follow the currently selected Office 2007 scheme. The amount of text it can display is limited: if you try to display too much text it will be truncated. You cant copy or save the content of the message. Because popup boxes are viewed as intrusive, people tend not to read them and end-up closing message boxes before they realize they may have contained useful information. They only displays plain text: you cannot format the message to draw attention to the key points. They are blocking, meaning that nothing can happen in the main application while the box is displayed (it cant even shut down). Sometimes you need to display an important message or require users to make take a decision. Message boxes are not to be abused but they serve a useful purpose.

An enhanced message box


Rather than using the bland standard message box you can now have something a bit more customized. Plain Text version of the enhanced custom message box under the Office Blue Colour Scheme:

RichText version of the enhanced custom message box under the Office Black Colour Scheme:

Here are the features of the enhanced message box: It is entirely compatible with the standard one: just change
MsgBox

to

Box

using find and replace

should be enough (see tip below to avoid getting strange errors). It allows the user to simply click on a button to copy the content of the message to the clipboard or save it to a text file to a configurable default location. It looks and feels like it belongs to the main application, following its colour scheme. It attempts to prevent users from blindly closing the modal box reading the message: buttons will first be inactive for a configurable amount of time. Its not a perfect solution, but it is quite effective. There is a RichBox version that can display rich HTML content, not just plain text, so important parts of the message can be formatted in a useful way. It is able to display large amount of data. While its not something you usually want, it may be useful for the message box to display more text in some situations (log or tracing information, legal documentation, etc). Rather than sprinkling your code with & vbCrLf & _ uglies, you can embed newlines in the text itself by using C-style \n escape sequences that will automatically be transformed into the appropriate newlines. Makes for clearer code and less typing. Because you get the source, you can easily customise the message box with new icons and colours to better match your overall applications personality. It is non-blocking: if your application forces users to log-off after a certain amount of inactivity, the enhanced message box will just close rather than prevent Access from shutting down like the standard MsgBox does. Of course, its up to you to decide how to handle that gracefully, if at all. It properly displays the expected button captions based on the language of the operating system, so it behaves very much like the default MsgBox (for instance, it will properly display Cancel on English systems and Annuler on French ones). It also properly plays the system sounds associated with the type of message. You can also enable or disable the sound effect as needed.

How to use it
Download the demo below and copy (drag & drop) the following into your application: the the the
FormDialog

form, module,

API_GetTextMetrics Dialog

module.
FormDialog ,

If you rename the


Dialog

make sure you replace any occurrence to it in the code, in particular in the

module.

Since the enhanced message box is just a replacement for the standard one, you just use it like you would use the MsgBox .

view plain

copy to clipboard

print

'----------------------------------------------------------------------------' Simple use of the Plaintext box ' Note the use of n that will be converted into a newline Dialog.Box "This is a plaintext message.\nClick OK to dismiss", vbOKOnly+vbinformation, _ "Message Title" '----------------------------------------------------------------------------' Getting the result back Dim dr as vbMsgBoxresult dr = Dialog.Box("Are you sure you want to delete?", _ vbYesNoCancel+vbQuestion, "Confirm action") if (dr = vbYes) then DeleteRecords '----------------------------------------------------------------------------' Using named parameters Dialog.Box Prompt:="All your bases are belong to us", _ Buttons:=(vbOkOnly+vbCritical), _ Title:="Bad error" '----------------------------------------------------------------------------' Using the RichBox to display simple HTML ' The first line will be bold, then the word 'button' will be printed in red ' Here the n will be escaped to '<br/>' tags to simulate newlines. Dialog.RichBox "<strong>This is a bold message</strong>.\n" & _ "Click the <font color=""#FF0000"">button</font> to dismiss.", vbOKOnly+vbinformation, _ "RichText Message Title"

There are a few additional settings that can be used to change the behaviour of the enhanced message boxes. One is that you can adjust the delay before the buttons become activated.
view plain copy to clipboard print ?

'----------------------------------------------------------------------------' Use the ButtonDelay to specify the time in seconds before the buttons become activated ' The default is 2s. Use 0 to activate the buttons immediately. Dialog.Box Prompt:="All your bases are belong to us", _ Buttons:=(vbOkOnly+vbCritical), _ Title:="Bad error", ButtonDelay:=1 '----------------------------------------------------------------------------' Change the default delay value. ' To disable the activation delay Dialog.DefaultButtonDelay = 0 ' To make the user wait 3 seconds before they can press any button Dialog.DefaultButtonDelay = 3

Another one is that you can enable or disable whether beeps should be played or not.
view plain copy to clipboard print ?

'----------------------------------------------------------------------------' Use AllowBeep to specify whether beeps should be played when the message box opens ' By default, they are. Dialog.Box Prompt:="All your bases are belong to us", _ Buttons:=(vbOkOnly+vbCritical), _ Title:="Bad error", AllowBeep:=false '----------------------------------------------------------------------------' Change the default behaviour. This is true by default. Dialog.DefaultAllowBeep = false

The last settings is the folder where we should save the content of the message when the user clicks the Save button on the message box.
view plain copy to clipboard print ?

'----------------------------------------------------------------------------' Change the save folder. ' By default, the text messages will be saved in the same directory as the database. ' Here we want them to be saved to a temp directory

Dialog.DefaultSavedTextFileFolder= "C:temp"

These few settings make the enhanced message box more customizable.

Large text
The standard
MsgBox

cannot display much text. On the other hand, there is no real limitation to the and
RichBox

amount of text the

Box

can display.

When the amount of information is too much to fit the maximum allowed size for the message box the text will overflow and can be scrolled up/down as necessary.

Limitations of the RichBox


The
RichBox

version relies on the normal TextBox controls ability under Access 2007 to display RichText

wich is nothing more than lightweight HTML. Because font size may be varying a lot in the message, it becomes very difficult to accurately predict the size of the box needed to display the whole message. Short of implementing a complete HTML engine, we have to rely on some assumptions to display HTML. The risk is that sometimes the content may not properly fit the TextBox control in some circumstances. If you use the RichBox , thoroughly try displaying your messages and tweak the HTML as necessary to include additional lines or non-breaking spaces to ensure that the result looks good. If you dont overuse font size and dont display in multiple fonts the RichBox should do the right thing most of the time. Dont overuse the
RichBox

to display colourful messages. There is a fine line between being informative

and tasteless. Keep colours and formatting where it is useful. I think that in most cases, the plain text version Box is more than enough.

Replacing MsgBox in existing code


As I said above, replacing the standard
MsgBox

is easy but you need to make sure your search and

replace parameters are configured correctly:

If youre getting strange compile errors, it may be because you forgot to tick the Find Whole Word Only and some of the strings containing the letter sequence msgbox were replaced in the process. If thats the case, you can revert the damage by simply doing a search and replace across the whole project on: - VbboxStyle or VbDialog.BoxStyle to be replaced with VbMsgBoxStyle VbboxResult

or

VbDialog.BoxResult to

be replaced with

VbMsgBoxResult

How it works
The code makes extensive use of Win32 API calls. Most of the hard work is done in the FomDialog class form. There is too much there to really go into the details but you are welcome to have a look at the commented code.

The code relies also on a utility function from Stephen Lebans used to calculate the size of of text. I have made some minor modification to that code so I would refer you to his original implementation if you are interested in calculating TextBox sizes for forms or reports. In the code for the
FormDialog ,

I re-implement some of the expected functionalities of the

MsgBox :

proper arrangement of the buttons, displaying of the appropriate icon, etc. Once this is done, we calculate the size of the textbox needed to display the whole of the message. In the case of RichText, we first use Application.PlainText() to convert the HTML into properly formatted plain text. We then calculate the Textbox size using a slightly larger font than needed as a way to ensure that the content of the RichText message will fit the box in most cases. Once we know the size of the TextBox, we can easily resize the form to properly display the TextBox. If there is too much text, we resize the form to its maximum permissible (70% or screen width and 90% of screen height) and change some of the visual cues to let the user know the text is overflowing. One thing of note is the way the form is kept modal. Rather than using DoCmd.OpenForm and DoCmd.Close I use the form as a class and create an instance manually (see the code in
Dialog.Box

and

Dialog.Richbox ).

I keep this instance alive until I got the forms


FormDialog.ShowModal()

result back. If you are interested in knowing how the form is made modal, this is the code in what keeps the form open until the user clicks a button:

view plain

copy to clipboard

print

01. 02. 03. 04. 05. 06. 07. 08. 09. 10. 11. 12.

Public Function ShowModal() As VbMsgBoxResult ... ' Here we reset the result for the clicked button such as vbOK, vbYes, etc ' This is set in each Button's Click event m_Result = -1 ' Wait for the user to click a button Do While (m_Result = -1) DoEvents Sleep 50 Loop ShowModal = m_Result End Function

The

Sleep()

function is a Win32 API that stops the current process for the given number of milliseconds.

This in effects hands back the control to the Operating System for a short time. That way the system is still responsive and does not consume resources when its just waiting for user input.

Sample database
You can download a sample database containing all the necessary code as well as a number of tests. This version only contains the database in Microsoft Access 2007 accdb format.

Download the EnhancedMsgBox01.zip (116KB), v1.3 containing the ACCDB database.

Code Updates
v1.3: 17MAR2009 Thanks to Henry of Access-Pro.de for proposing a correction to the default buttons behaviour. Updated behaviour for the default buttons. They are now focused in a way that matches that of the standard msgbox. Reversed the naming of the buttons on the form to make it a bit more consistent with the standard box. v1.2: 07SEP2008 Thanks to Andy Colonna (http://www.pcesoft.com) for uncovering the following bugs (check out his free Spell Checker with source code!): Corrected bug in
Form_FormDialog.FilenameSanitize()

function that would fail to remove all invalid

characters for a file name. File name for the saved text message will be truncated to first 32 characters of message box title in Form_FormDialog.MakeFriendlyFileName() . Changed the use of
FollowHyperlink

to

ShellExecute

to avoid security warningin some instances in that would result

Form_FormDialog.btCopyToFile_Click()

Corrected twips to pixel conversion bug in

API_GetTextMetrics.fTextWidthOrHeight()

in an improperly sized dialog box when the text message was too wide. v1.1: 08AUG2008 Corrected code for
DefaultButtonDelay

(thanks to Geoffrey) (was referencingwrong variable, causing


DefaultSavedTextFileFolder into

self-referencing code). Corrected code for Box and

RichBox

to take the

account (the path

was previously not passed onto the dialog boxes and the text file would always be created in the application folder instead of the one specified by DefaultSavedTextFileFolder ) Added license notice at top of source code.

v1.0: 20MAY2008 Original version

Resources
Dissecting the MessageBox article on CodeProject XMessageBox -- A reverse-engineered MessageBox() article on CodeProject TextWidth-Height code demo from Stephen Lebans (great resource, check it out!). Pixel to Twips conversion from MSDN. Copy Text to Clipboard from the excellent site The Access Web. Getting Resource Strings and more from DLLs.

This work is licensed under a Creative Commons Attribution 3.0 Unported License. Free for re-use in any application or tutorial providing clear credit is made about the origin of the code and a link to this site is prominently displayed where end-users can easily access it.
Entry Filed under : .Net,Business,Database,MSAccess,Programming

59 Comments

Add your own

1.Edwin Blancovitch | June 5th, 2008 at 5:00 am WAO !! i cannot say more . . .this is extremely good . . . i saw other solutions but yours surpass all others, congratulations . . . keep on doing the good work . . .

2.Renaud | June 7th, 2008 at 4:04 pm Thank you Edwin.There are plenty more that Id like to do, just a matter of finding the time

3. Marvin | June 30th, 2008 at 2:00 pm Simply smart! Thank you, Sir!

4. Anon | June 30th, 2008 at 11:59 pm Simply fantastic, great work, thank you!

5. Ken Warthen | July 30th, 2008 at 10:14 pm Renaud, Your website was a real find. I love the enhanced message box utility for Access, as well as the modal dialogs with transparent backgrounds. These are awesome tools that help Access developers to create interfaces that have some visual appeal. Thanks so much for your efforts and generosity. Ken Warthen

6.Renaud | July 30th, 2008 at 11:11 pm

Thank you for your kind words, Im glad you found some of these articles useful.

7. Glenn | July 31st, 2008 at 6:13 pm Renaud, I have briefly looked over your custom message box concept and like what I see. I am curious, however, because unless I am mistaken you have implemented it in Access using standard modules rather than as a class. Is there any particular reason you didnt create a class instead? Glenn

8.Renaud | July 31st, 2008 at 6:56 pm Hi Glenn,I think the main reason I didnt use a class was that I wanted a drop-in replacement for the standard MsgBox.Using a class would have required creating an instance of it either every time the box would be used, or stored somewhere in a module.Classes also become an issue as they cannot be instantiated directly from a library (the way I usually re-use code) and you must end-up having a class factory in a Module instead. It doesnt mean it cant be done. I just dont think it bring anything useful doing it in a Class as opposed to a Module in this case. Maybe Im wrong and there is a better way. In that case let me know :-)

9. glenn | August 1st, 2008 at 12:26 am Renaud, Thanks for that. Your explanation makes perfect sense and I cant think of a compelling reason to suggest that a class based alternative would be preferable. Code libraries are certainly the way to go for frequently used code. While using a class in this case doesnt appear to offer an advantage over your standard module approach, you might be interested to know that there are a couple of ways to include classes in code libraries such that any application using the library can create instances of the relevant classes. Glenn

10. Moo | August 1st, 2008 at 6:49 am This is rather awesome! Mind if I take a shot at back-grading it to Access 97?

11.Renaud | August 1st, 2008 at 9:57 am @Glenn:I use a simple module that I call ClassFactory whose only purpose is to return an instance of the Classes in the library. Not sure if there is a better way. @Moo:please be my guest. I have been thinking about this recently but since I only have Access 2007 testing for older version is a bit of a challenge. Adapting the code to older versions should not be difficult if you stick to plain text. You will have to remove references to the TextFormat property of the txtMessage textbox as it is new in Access2007 and used to switch between plain text and rich text. As far as I know, the only way to bring rich text to older versions of Access is to use a webbrowser

control. If you manage to convert it, please send me the updated database so I can host it here for all to find.

12. Glenn | August 1st, 2008 at 4:25 pm Renaud, You can do without the module by manipulating the class modules Instancing property. The catch is that the property sheet doesnt allow the setting you need but you can run a single statement in the immediate window to do the job. See this post http://www.utteraccess.com/forums/showthreaded.php? Cat=&Number=1441683&page=&view=&sb=5&o=&vc=1 Glenn

13.Renaud | August 3rd, 2008 at 3:20 pm Hi Glenn,thanks for the tip!

14. Moo | August 6th, 2008 at 6:33 am Renaud, I gave it a shot and without the RTF it just wouldnt be the same; so I chose not to pursue it any further. The Access 2007 version is striking! Thanks! Moo

15. Larry | August 6th, 2008 at 1:14 pm Get a compile error when trying to run it. User defined Type not defined..Dim f As New Form_FormDialog.Have the same references checked in my Access 2007 VBA. Looks great. Would like to solve the problem to be able to use it. Thanks.Larry

16. Alan Cossey | August 7th, 2008 at 4:02 am This is excellent. Ive just added it to a new application and it looks far better and I like the ability to copy the message to the clipboard. It is also very good that it is non-blocking, i.e. I can now more easily chuck users out of my systems if I want, say, after a period of inactivity.A point that people might find useful is that rather than replace all instances of Msgbox in your code with the word RichBox, you can rename the new RichBox function as Msgbox. When your code then goes to call the Msgbox function, it then calls the new function, i.e. the old Msgbox gets overridden and the new function is called instead.

17.Renaud | August 7th, 2008 at 2:07 pm @Larry: does this happen with the demo or in your application?Have you renamed the FormDialog? if thats the case, make sure to change the line where you get the error to reflect the new name. Another possibility is security settings: if youre getting a security warning when opening the file, make sure you open it from a Trusted location or some functions will be disabled. @Alan: its a good point and it could make replacement much easier, although I usually prefer to err on the side of caution and avoid overriding base functionality to avoid unintended consequences (and keep in line with the element of least surprise motto by making things explicit). :-)

18. Geoffrey | August 8th, 2008 at 12:36 am Thanks for the great object! Out of Stack Space Error Occurs when modifying DefaultButtonDelayTry modifying the Enable Buttons In: field in sample form Problem occurs in module Dialog Reads:
Public Property Let DefaultButtonDelay(delay As Long) If delay < 0 Then delay = 0 DefaultButtonDelay = delay End Property

Should read:
Public Property Let DefaultButtonDelay(delay As Long) If delay < 0 Then delay = 0 m_DefaultButtonDelay = delay End Property

19. Larry | August 8th, 2008 at 7:01 am Compile error happens in my application which is in a Trusted location. Didnt rename anything other than MsgBox changed to Box as instructed; for one of my boxes. Am I supposed to rename something else? The compile error highlights the following VBA codeDim f As New Form_FormDialog.Larry

20.Renaud | August 8th, 2008 at 10:26 am @Geoffrey: good catch, I have updated the code. Thanks for notifying me. @Larry: still not sure why youre getting this. Could you send me a zip file of your application so I can investigate? Send it to accessblog#nkadesign* (replacing # by @ and * by .com).

21.Renaud | August 8th, 2008 at 3:20 pm @Larry,:you were missing the


FormDialog

in your application.

I have updated the article to list the instructions on how to include the new code into your own application. I realised this was missing.

22. Larry | August 9th, 2008 at 6:37 am Success! Enhanced Message Boxes are so much easier to identify when they pop up on the screen. The standard msgboxes are so bland they are almost camoflauged. Thank you very much,Larry

23.Jack Stockton | August 9th, 2008 at 6:56 am Your code is way better that what I have written and really works as a replacement to the standard MsgBox function.

Would like to suggest an enhancement.ability to specify customer text for two. I often have a business case where I am displaying a message box asking the user if they want to replace or open the existing.

24.Jacques | August 12th, 2008 at 6:57 am I got stuck A friend sent me the A2003 version, but it now appears that the RichText.ocx is blocked because of security reasons (apparently they deem it safe in A2007). I registered RICHTX32.ocx 6.0 (SP6) under references, but the 2003 mdb doesnt compile: acTextFormatHTMLRichText is not found -- I found a registry-patch here: http://p2p.wrox.com/topic.asp?TOPIC_ID=10894 -- doesnt work on my pc. There is also a replacement, by Stephan Lebans: http://www.lebans.com/richtext.htm -- registering it, didnt help either. Also, the .png images dont load -- apparently they dont get included on converting -- could you include them separately? Any suggestions? I really would like to give this replacement a try -- I do see its potential, but as I dont have A2007, I cant run it as such.

25.Renaud | August 12th, 2008 at 3:51 pm @Jacques: I can only think of the webbrowser control as a replacement. May be too much overhead but its worth a try.Ive sent you the icons by email.Let me know if you succeed :-)

26.Andrew Craven Rohm | August 12th, 2008 at 6:10 pm Thank you. Pretty good work. Theres one extension Id like to implement or see implemented, autowrap for long texts. Theres one slight problem with the code as it stands The Default Buttons are not set properly. The Code for this looks fine until you notice that the buttons are named in the reverse order to their use. bt3 is used as button1, etcetera. The rest of the code reflects this, the Timer event which sets the default does not. Easy to change in the timer event just replace each occurence of bt1 with bt3 and bt3 with bt1. Thanks again,Andycr

27. Stefan Reichelt | August 13th, 2008 at 10:17 pm Whow! What a great enhancement for my Access Tools. I just tried it and was really happy. Now theres a variation I would love to see: A modified InputBox! Could you do that, too? Regards from Germany, Stefan

28. Joey | September 20th, 2008 at 2:45 am Will this tool work with an .adp file? If so, what mods are necessary?

29.Michael Merlin | September 28th, 2008 at 6:27 am

@Joey: should work perfectly fine in .adp @Renaud: brilliant work!

30. Scott Cordwell | October 30th, 2008 at 11:22 am Thanks for this, great enhancement. I dont seem to be able to get any of the buttons to be the default button, any help would be greatly appreciated. Cheers from downunderScott

31.Renaud | October 30th, 2008 at 3:48 pm @Scott: glad you find it useful. Regarding the default button, its not really a feature I wanted to use as one of the points of using this enhanced MessageBox is to force users to stop for a second and think about the action they need to perform rather than just hitting ENTER or ESC without thinking, as is the case with the standard box. Ill make a note of your suggestion for the next update and probably add it as an option (or a default that can be disabled).

32.Change Color of Text | ke&hellip | January 19th, 2009 at 12:44 am [...] Change Color of Text Hi Akilah, I ran across this that might help you: http://blog.nkadesign.com/2008/ms-acx-replacement/ Bonnie http://www.dataplus-svc.com Akilah wrote: >Hi, is there a way to change the color of [...]

33. Dan | January 27th, 2009 at 3:58 am Could someone send me an A2003 version of this code? This sounds like exactly what I need.

34. Andy | January 29th, 2009 at 3:02 am Hi Renaud -- this is awesome :) Just a quick question -- is there scope to include customising the buttons? So rather than the standard vbYes vbNo etc.. you can customise them?

35. Ryan | February 6th, 2009 at 9:10 am I downloaded your Enhanced MsgBox and it worked great. It definitely fit the bill for what I was doing until I created an ACCDE version for the users. I end up with the error: The expression you entered has a function name that the database cant find. I have the Enhanced MsgBox getting called during an on click event on a button by using =RichBox([field]). Any ideas?

36.Henry | February 7th, 2009 at 2:48 am I fixed your vbDefaultButton behavior bug in Form_Timer(). can I send you the code?

37.Renaud | February 7th, 2009 at 9:23 am To Ryan: have you tried calling the RichBox from code rather than directly from the Onclick event

handler? To Henry: yes please, send the fix and I will update the code and the samples for everyone. My email is in the footer of the page.Thank you.

38. Ryan | February 7th, 2009 at 8:32 pm Its been a long time since Ive used Access and so Im getting my feet re-wet. Can you refresh me on some code I would use to call it?

39.Andrew | February 18th, 2009 at 1:22 am Thanks for this excelent code. I think it may be usful to a project I may play with later on.

40. Ash | February 23rd, 2009 at 11:42 am Great work based on details and comments. I cant possibly use this utility in Access 2002, can I?

41.Renaud | February 23rd, 2009 at 12:38 pm @Ash: thanks. Unfortunately, there is a major show-stopper if you want to get this to work in pre2007 versions of Access: older versions dont have rich-edit textboxes, so you would probably have to rely on a webbrowser component and that would change a lot. If you are OK with being limited to the plain version of the enhanced MsgBox, then your only other issue should be with displaying transparent images for the icons.

42. Tom Dessert | March 6th, 2009 at 4:28 am Have you developed the code for those of us non-Office 2007 users. I have Office 2003 and would really like to apply this enhancement. ThanksTom

43.Renaud | March 9th, 2009 at 10:08 am @Tom Dessert: no. I thought some good soul would try. Id be happy if someone did. My main issue is that I dont have any older version of Access so I cant really test the implementation and be sure about the result. Just saving the project in an older format wont work properly at Im using some A2007-specific features.

44. John White | May 13th, 2009 at 3:23 pm Brilliant code Renaud Very helpful Thanks. Im old at Access but new to the type of coding you used to create the enhanced msgbox. I am hoping to use your code to allow users to activate custom help files from a Help button in some dialogs (doesnt seem to work in standard Access 2007 msgbox -- just fires up the Access help even when custom help file and context are indicated)In my first atte,pts to use your box I see that I can now reach the forms help file using F1 from the dialog.box but it must be possible to use the standard Help button.Can you help or advise please?Regards John

45. John White | May 13th, 2009 at 7:15 pm

Regarding my last comment Ive added a ? button in the same way as your btCopy and BtSave and put Sendkeys {F1} into the Click event to fire my custom help. Next issue please, I like to set the mouse pointer to jump to default buttons on dialog boxes which works with the standard Access 2007 dialogs but not with my new good looking ones. Is it possible to obtain this behaviour on the custom dialog box?Regards John

46. Uros | June 29th, 2009 at 4:33 pm Thanks for this excelent code, fantastic :)

47. Matthew Pfluger | July 23rd, 2009 at 12:13 am Thank you for your hard work and the wonderful message box! A quick comment, I will be using this box to display a warning to my users that I will be terminating their connection so I can perform updates to the back end. Id like the Box to AutoClose after a certain period of time regardless of user interaction (or more likely, non-interaction). I can program this in myself, but it may be a useful feature to others as well. Thanks again,Matthew Pfluger

48. kirkrqm | August 8th, 2009 at 8:37 pm Thanks for the great code! I added a line to default the dialog caption to the application name if no title is explicitly set. First few lines of Form_FormDialog::ShowModal are: If m_Title <> Then caption = m_Title & Else caption = CurrentDb.Properties(AppTitle) End If

49. Marianne Berkhof | October 8th, 2009 at 8:01 pm Hi! Tnx 4 your beautiful messagebox. I only have one question: is it possible to use a vbTab in the message? With regards,Marianne

50. Lxocram | December 18th, 2009 at 4:57 pm Do you have an inputbox variant for this as well? If only i had the time to combine this with http://www.databasejournal.com/features/msaccess/article.php/3848121/Extending-the-InputBoxfunction-for-MS-Access-Forms.htm Spare time? Anybody?

51. David | February 13th, 2010 at 9:53 pm Sir, this is most excellent! Thanks for sharing.

52. John | February 16th, 2010 at 4:29 pm I have downloaded your example database. Im using Access 2007 but something odd happens. Non of the buttons on the test form seems to activate a trigger. In short, nothing happens. Do you have an explaination for that?

53.Bob Robinson | April 16th, 2010 at 8:57 pm I would like to use vba code to close a message boc programmatically, as Matthew Pfluger suggest he can do in his July 23rd, 2009 message. Can someone please tell me how to do this. I too am an avid user of your message box replacement. Thanks. Bob Robinson

54. Dave | May 25th, 2010 at 10:08 pm This looks very useful, could you please post the source code so those of us not using 2007 can have a go at extracting those parts that will work in earlier versions? Many Thanks, Dave

55.Deleted Image displayed w&hellip | June 17th, 2010 at 7:02 pm [...] found the custom message boxes at http://blog.nkadesign.com/2008/ms-acx-replacement/ and edited it to fit my needs Background colours, borders, etc as well as the Images [...]

56. Ken Warthen | October 27th, 2010 at 2:15 am Do you know of any similar utility for MS Excel? Ken

57.MsgBox Placement&hellip | December 27th, 2010 at 3:45 am [...] really but you can create your own: http://blog.nkadesign.com/2008/ms-ac-replacement/## __________________ (RG for short) aka Allan Bunch MS Access MVP -- WinXP Pro, Win7 Pro- acXP, [...]

58. Sooz | January 25th, 2011 at 2:42 am A nice replacement message box, that solves the problem (found under Access 2010) of dialog boxes stopping being modal before the user presses a button! However, the png graphics image files would really be appreciated My app has to be capable of running under Access 2003, 2007 and 2010 so to keep a similar look and feel I need to create some bitmaps for the old version.

59. Greg | February 5th, 2011 at 4:17 am Superb! Just came across this, it has given my application a finished look. One question, how do I force the application to close after the Dialog.RichBox appears, I checked the example and the check box does not fire any code.

You might also like