<body><script type="text/javascript"> function setAttributeOnload(object, attribute, val) { if(window.addEventListener) { window.addEventListener("load", function(){ object[attribute] = val; }, false); } else { window.attachEvent('onload', function(){ object[attribute] = val; }); } } </script> <iframe src="http://www.blogger.com/navbar.g?targetBlogID=34083602&amp;blogName=LEARN+MS-ACCESS+TIPS+AND+TRICKS&amp;publishMode=PUBLISH_MODE_FTP&amp;navbarType=BLUE&amp;layoutType=CLASSIC&amp;searchRoot=http%3A%2F%2Fblogsearch.google.com%2F&amp;blogLocale=en_US&amp;homepageUrl=http%3A%2F%2Fwww.msaccesstips.com%2F" marginwidth="0" marginheight="0" scrolling="no" frameborder="0" height="30px" width="100%" id="navbar-iframe" allowtransparency="true" title="Blogger Navigation and Search"></iframe> <div></div>
www.msaccesstips.com

LEARN MS-ACCESS TIPS AND TRICKS


International Response Fund

LEARN MS-ACCESS TIPS AND TRICKS

↑ Grab this Headline Animator

Your Ad Here
Friday, September 29, 2006

MsgBox with Office Assistant

The left side message box is the default style of MS-Access and the right-side one is with the use of Office Assistant. The Program uses the default Office Assistant Setting for Message Boxes. Here the Office Cat is the default setting, hence it is appearing with the Message Box. By adding a few Functions in a Global Module of your MS-Access Project will help you to make use this feature wherever you need them. Some of the very commonly used Functions are created separately for ease of use limiting the maximum Number of Parameters needed for the Functions to two and 2nd Parameter for Title is Optional and can be omitted. First Parameter for Message Text and the second one for Title. Button Type and Icon Type is already added to the Function. The following Functions are available and their usage Syntax is as follows:

MsgOK("Message Text","Title") - MessageBox with only OK Button

MsgYN("Message Text","Title") - MessageBox with Yes & No Buttons. Returned Value is vbYes or vbNo

MsgOKCL("Message Text","Title") - MessageBox with OK, Cancel Buttons. Returned Value is vbOK or vbCancel

First you must attach the Microsoft Office 9.0 Object Library (or whatever version of Office you have) to your Project. You must add other essential Library Files to your Project as well. Please refer my earlier post Title: Command-Button Animation for a List of Project Library Files and procedures to attach them to your Project. After completion of Library Files fixing copy the following Code into a Global Module and save them.



Public Function MsgOK(ByVal strmsg As String, _
Optional ByVal strHeading As String) As Integer

On Error resume next
MsgOK = MsgBalun(strmsg, strHeading, msoButtonSetOK, _
msoAnimationGestureUp, msoIconAlertInfo)
End Function


Public Function MsgOKCL(ByVal strmsg As String, _
Optional ByVal strHeading As String) As Integer

on error resume next
MsgOKCL = MsgBalun(strmsg, strHeading, msoButtonSetOkCancel, _
msoAnimationWritingNotingSomething, msoIconAlertQuery)
End Function


Public Function MsgYN(ByVal strmsg As String, _
Optional ByVal strHeading As String) As Integer
on error resume next
MsgYN = MsgBalun(strmsg, strHeading, msoButtonSetYesNo, _
msoAnimationWritingNotingSomething, msoIconAlertQuery)
End Function


Private Function MsgBalun(ByVal strText As String, _
ByVal strTitle As String, ByVal lngButtons As Long, _
ByVal intAnimation, ByVal intIcon) As Integer
'------------------------------------------------------------
'Author : a.p.r. pillai
'Date : September 2006
'------------------------------------------------------------
Dim lngx As Long, intVal As Integer, Balu As Balloon
On Error GoTo MsgBaloons_Err

With Assistant
If .On = False Then
.On = True
'.FileName = "OFFCAT.acs"
.Animation = msoAnimationGetAttentionMinor
.AssistWithHelp = True
.GuessHelp = True
.FeatureTips = False
.Visible = True
End If
End With

Set Balu = Assistant.NewBalloon
With Balu
.Animation = intAnimation
.Icon = intIcon
.Heading = strTitle
.Text = strText
.BalloonType = msoBalloonTypeButtons
.Button = lngButtons

Select Case Balu.Show
Case msoBalloonButtonOK
MsgBalun = vbOK
Case msoBalloonButtonCancel
MsgBalun = vbCancel
Case msoBalloonButtonYes
MsgBalun = vbYes
Case msoBalloonButtonNo
MsgBalun = vbNo
End Select
End With

Assistant.Visible = False

MsgBaloons_Exit:
Exit Function

MsgBaloons_Err:
MsgBox Err.Description, , "MsgBaloons"
Resume MsgBaloons_Exit
End Function


You can use these Functions without bothering about selecting the Button-Type, IconType etc. that you normally need to give along with the MessageBox Command like: vbYesNo+vbDefaultButton2+vbQuestion

Usage Example:

1. If MsgYN("Select Yes to Proceed, No to Cancel.","cmdProcess") = vbYes then

Docmd.runmacro "Process"

End if

OR

If MsgYN("Select Yes to Proceed, No to Cancel.") = vbYes then

Docmd.runmacro "Process"

End if

2. MsgOK "System is preparing to Shut Down","cmdExit_Click"

OR

MsgOK "System is preparing to Shut Down"

The MsgBalun() Function is not directly used in programs.

Implement the procedures in your Project and try them out.






Download Demo Database




Create 3D Heading
Shadow 3D Heading Style
Border 2D Heading Style
Border 3D Heading Style

Labels:

1 Comments:

Blogger SoggyCashew said…

This is great and I use it for some of my msg boxes but I would like to know how to use this with an input box lets say for a password protected button to open a form. Can someone explain in detail due to im a neeb...

Thanks,
Soggy

March 06, 2008 7:54 PM  

Post a Comment

Note:Comments subject to Review by Blog Author before displaying.

Links to this post:

Create a Link

<< Home


Creative Commons License
Learn MS-Access Tips and Tricks by msaccesstips.com is licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 2.5 India License.



This Page is best viewed with 1280 x 1024 Resolution

   FEATURED LINKS
SITEMAP
Command Button Animation
3D Headings on Forms
MsgBox & Office Assistant
Reminder Ticker
MS-Access & E-Mails
Automated E-Mail Alerts
MsgBox with Options Menu
Colorful Command Buttons
Configure Lotus Notes
Alerts through Network
Running this site has become a costly affair as the revenue from Ads is not sufficient to support it. If you find these pages informative & useful and would like to extend a helping hand, then please do it here.





Link Back to us with this Button

Learn MS-Access

Copy and Paste this HTML Code in your Webpage


Add to Technorati Favorites

Programming Blogs - Blog Catalog Blog Directory
Powered by FeedBurner
Add to Google

Software
Computers blogs
TopOfBlogs




AddMe - Search Engine Optimization Submit Your Site Free!
Go BlogZ Ave Blogs
eBlogzilla Changing LINKS
LS Blogs Blogarama
blog search directory BlogUniverse
Find Blogs in Directory RSS Directory
blogskinny.com ShowcaseBlogs.com
Amfibi

Search Engine Optimization and SEO Tools
Dmegs Web Directory Takeaway for Sale Businesses For Sale
Free Submission Directory Free site submission

Free Listing
 





Free Page Rank Checker

AddThis Social Bookmark Button

Enter your email address:

Delivered by FeedBurner



Top Blogs


Microsoft Access is the Jewell among MS-Office suite of Applications. Its Security features are excellent and works fine in Network environment. MS-Access can link/upload data from any Data Source. Applications that you design should be user-friendly and visually pleasing too. Here I would like to share my experience in Microsoft Access Programming with you and I am sure that you will find them interesting too.

My Photo
Name: Ramachandran Pillai
Location: Cochin, India

I am not an Access Guru and not through MS-Access yet. More to learn and I don’t think that aspect has any end because others have their own style of using this tool. We can learn lot more tricks, other than what we already know, from others too. My programming skills in COBOL, BASIC, Turbo-C, dBase, FoxPro, Visual Basic & Basic HTML attained through self-learning. I wrote my first COBOL Program in 1975 for ICL1901, 3rd Generation Main Frame Computer. Worked as a Computer Operator (NCR VRX8555 Mainframe Machine upto 1990) with M/s. Y.B.A. Kanoo, Saudi Arabia. Started using MS-Access Ver.2 in 1996, when dBase III+ and Foxbase (later version Foxpro) were my favorite DBMS. During Last 13 Year period I have developed more than 45 In-House Applications (medium & small) under MS-Access for our Organization, a leading Automotive Company in Oman. All the Applications are fully Secured and runs under Windows Network. It is my pleasure to share my experience with others. Anything interesting that you would like to share with me, please do. My E-mail Address: aprpillai@msaccesstips.com


If you need a Demo of any of the Topic explained here, send me an E-mail to: aprpillai@msaccesstips.com
with the Topic Description, I shall try to send a sample database to you.


Access Tips | Email | Reports | Report Tricks | Graphs | Forms | Menus | Animation | Security | Internet | How TOs | Linking | Query | Progress Meter | Alerts | Process Tips | Access Functions |




Site Designed by:www.msaccesstips.com