vb123.com

Garry Robinson's Popular MS Access, Office and VB Resource Site

 

Home  Contact Us
Order our Software

RSS & Newsletter  
Join our XML/RSS Newsfeed or sign up for our informative newsletter on Office Automation, Access and VB topics
Read More

Get Good Help
If you need help with a database, our Professionals could be the answer
Read More

  Is Your Database Corrupt ?
If you have a corrupt database, Try our Access Recovery service

The Workbench  Find out who has your database open, start the correct version of Access, easy compacting and backups, change startup options, mde compile,  shutdown database Read and Download

The Toolshed 
Searchable help file comprising of all the information at vb123.com plus hidden downloads etc. Read More



The Toolbox

Libraries of software that we regularly import into our projects. Enhances the Toolshed More..


DryToast New
Backup and query your BaseCamp
® projects
Read More


Datamining/Graphs

Explore your data with this versatile graphing and data mining shareware tool.  Read More

Garry's Blog
Find out a few other things that Garry has been writing about Microsoft Access. Read more

About The Editor Garry Robinson writes for a number of popular computer magazines, is now a book author and has worked on 100+ Access databases. He is based in Sydney, Australia
Contact Us ...

Search ...

or try our new Expression Web
 vb123.com.au
 

 

Next Tip  The Microsoft Balloon Is More Than Just Hot Air

When discussing the Microsoft Office Suite with your users, you probably have run into some negative feedback to that paper clip help thing that jumps up on the screen and offers to help you out. Why does this invoke a negative reaction in users. My guess is that the information being offered really is not relevant at the time. Also you probably still are not highly excited about have a power pup or a 110 year old genius telling you what a database is when you have been programming database for 20 years. Before we go any further, we may as well call this "know it all" by his/her programmable identity and that is the Balloon object. He/she also is sometimes refered to as the Office Assistant (when he behaves himself).

In this article I will show you how you can unleash the Balloon on the users of your software and hopefully provide them with some really information that is relevant to their current activity. To illustrate this, figure one shows Albert Einstein informing you how you can use the download that is provided with this article. As you can see, the information is well arranged and clearly informs you what to do with the software. You may now do a number of things with this piece of on screen advice. One is to keep it on the screen as is, another it to a move it to a more suitable position on the screen so that you can still see the advice and the third is to get rid of it. This article and its download database shows you how you can manipulate the Balloon object using visual basic and provides a class module to make that programming even easier.

Figure 1 – Inform Your Users With The Office Balloon (Click to expand)

 

Informing Your Users Of Enhancements To Your Software

The project where I first utilized this balloon technology was on an Access database with 10 or so users. After a while, the users stopped reading my emails informing them about changes to the software and basically just used the software until something went wrong. Initially I resolved this by putting up a message box with a list of the new options/changes that had recently been added to the software. After a while, it became apparent that message boxes are for pointing your mouse at so that they disapear as quickly as possible. Then I stumbled across the balloon and decided to use that as an alternative way of displaying the list of enhancements. With the messages in the balloon (figure 1), the user can keep the information on the screen and review the software at the same time. This is possible as the Balloon is not part of your Access interface. Another good thing about the Balloon is that bulleted items are a feature of the balloons display capabilities unlike message boxes where you have to introduce your own carriage returns and text bullets. So what do we have to do to fire up a balloon and add a message or two. Just add the following code to your application.

 

Set Balloon_FX = New FXc8_Balloon

With Balloon_FX
  .emptyBalloon
  .pumpBalloon "My first point is …"
  .pumpBalloon "and secondly I would like to say"
  .showBalloon "This is my first balloon message ", _
"Have you seen enough, then click OK"

End With

Set Balloon_FX = Nothing

 

A Class Module Makes Office Automation Easier

Of course there was a bit more to releasing your first balloon than typing the few lines above and that leads me to my standard approach when I program complex Office objects. I generally build a class module to provide a simple gateway between the actual object and the application. This means that I have far less code in my actual applications plus I can make use of VB intellisense to assist me in my programming. So what do you need to do to add this class module to your application

Import the class module FXc8_Balloon from the supporting database

Import the module FXL8_Records from the supporting database

Open a module in your application.

Choose references

Add a link to the Microsoft Office 8 or Office 9 Object Library

Now when you need to start up a balloon in your application, instantiate your Balloon class library as follows

Set Balloon_FX = New FXc8_Balloon

With Balloon_FX

Now type the full stop on the next line and the following methods will become available to blow up and release your balloon

.pumpBalloon Message

This is how you add the bulleted points to your balloon. You may add as many as you like but only the first 5 will be displayed on the balloon

.howFull

HowFull is a property of the class module that will tell you how many messages you have added to the balloon.

.emptyBalloon

You can clear all the messages from your balloon using this method.

.showBalloon Header, Text, Icon

Show balloon is the method that will display the balloon with your header. Text is an optional field to display additional text between your point messages and the header. Icon is also optional and varies the display of either a warning icon, a tip icon or no icon at all.

Set Balloon_FX = Nothing

And of course when you have finished adding notes to your balloon, do not forget to release the balloon object. Note that that the balloon will still float around with your Access application until your user clicks the OK button. I will return to the mechanics of manipulating the balloon later in the article.

Informing Your Users Of Problems With Their Data

An even more useful application of the Balloon object is informing users of problems with their data entry before they save a record on a form. This differs from the normal verification of data on a field by field basis. This technology is now getting its biggest workout in an insurance application with a complicated form with over 50 fields on the one form. In this form there was a number of levels of checking that need to be performed according to the progress of the insurance claim. In the inquiry level, the software only needed to check a few fields for correctness but when the claim was accepted, the levels of checking became quite complicated. Prior to use of the balloon, the user would face a maddening number of message boxes popping up during the data entry such as that in figure 2

Figure 2 – Message Boxes for Data Entry Issues Can Interfere With Data Entry

 

Now all the data integrity is handled at the end of the data entry using the balloon object and the user is presented with a maximum of five data entry issues at a time. Why five, well that is the maximum number of bulleted messages that the balloon will allow. Also five messages is a good number as any more would simply fill the screen with too much information. If there are more than 5 errors on the form at the one time, you can show the others after the user has tried to fix up the first five.

The secret to handling this type of checking before the record is saved lies in the Before Update event on the form. This event will fire up whenever the user tries to save a record even if the record is a brand new one. So if you open the Balloon demo form in the demonstration database in design mode, search for the Before_Update event module which goes something like this

Private Sub Form_BeforeUpdate(Cancel As Integer)

Set Balloon_FX = New FXc8_Balloon
With Balloon_FX
  .emptyBalloon

' Now test the fields in the form

  If IsNull(Me!EmployeeID) Then
    .pumpBalloon "You need to enter the Employee "
  End If

  If IsNull(Me!OrderDate) Then
    .pumpBalloon "You need to enter the Order Date "
  End If

  If IsNull(Me!Freight) Then
    .pumpBalloon "You need to enter the Freight Costs"
  ElseIf Me!Freight = 0 Then
    .pumpBalloon "Set the Freight Cost to greater than zero"
  End If

  If .howFull > 0 Then
    .showBalloon "Before Saving The Record ", "You need to", msoIconAlert

' Now cancel the update to the form
    Cancel = True
  End If
End With

Set Balloon_FX = Nothing

End sub

The code that I have used to display error messages varies little from the first example except that I now test if there are any error messages before displaying the balloon and canceling the form update event by setting the subroutine argument to Cancel.

To assist the user in saving the record, I generally add a save record button on the form which calls a database module called SaveRecord. You will be surprised how many users click on the Save Form button on the Toolbar to save the record which unfortunately does not save the current record.

Another anomaly that you may want to trap is when the user closes the form without saving the record. This results in the form update event being initiated but the form is closed without the user having any chance to modify the problems with the data. To handle this, I have a global subroutine called FormError_SaveRecord that is called from the Form Error Event.

Private Sub Form_Error(DataErr As Integer, _
  Response As Integer)

  Call FormError_SaveRecord(DataErr)

End Sub

Public Sub FormError_SaveRecord(DataErr As Integer)
  If DataErr = 2169 Then
    MsgBox "Warning - You will discard the current" &_
     "data changes if you choose Yes to the next " & _
     "prompt", vbExclamation, "Problems Saving Record"
  End If
End Sub

What Sort Of Gas Fills The Balloon

For those of you that have avoided class modules in your programming, the balloon class module (called FXc8_Balloon) is a good example of how simple programming can be when you pick an appropriate task for your class. For this module, we have 3 class wide variables to store the messages as follows

Const NoMsgs = 20
Dim msgs(NoMsgs) As String
Dim MsgCnt As Integer

The first thing that we will tell the class module after it is instantiated is the messages list. This is handled through the public subroutine pumpBalloon. In this case I could have also handled this using a class property but it is likely that I will possibly add additional optional arguments to the subroutine at a later date so a subroutine makes that enhancement simpler. The emptyBalloon and HowMany subroutines that are not show in the code snippets also handle the message list.

Sub pumpBalloon(Message As String)
  MsgCnt = MsgCnt + 1
  msgs(MsgCnt) = Message
End Function

All the action in the balloon class module happens in the subroutine showBalloon. If you want some associated reading on the topic, do no more than type in "Balloon" into your Access help. Here you will find that the Balloon is one of three objects shared across the Office suite. The other two are the Command Bar and the File Search object. One of the Balloon samples provided me with the basis on which this class module is based. The initial code of the ShowBalloon method handles the optional arguments in the routine. If you wish to find out alternative constants to use for the icon or mode or type of Balloon, right click on the constant and choose definition (alternatively Shift-F2).

Public Sub showBalloon(BalloonHeader As String, _
  Optional BalloonText, Optional BalloonIcon)

Dim bln As Balloon, i As Integer
Const BalloonType = msoBalloonTypeButtons
Const BalloonButton = msoButtonSetOK
Const BalloonMode = msoModeModeless
Const BalloonSub = "CloseBalloon"
If IsMissing(BalloonIcon) Then
  BalloonIcon = msoIconTip
End If

Note above that I have two hard coded constants for Balloon Mode or Type which I have set as Modeless and to display the OK button. These settings are the simplest settings of the Balloon and are entirely suited for the tasks that I perform in the demonstration database. Changing these options can give your users an interactive interface such as returning choices and yes / no selectors and a variety of other goodies. Be very careful about going too far down this path as you will then be setting up a conflicting interface for your users to learn and contend with. I have left a few notes inside the software to explain these constants. Now we instantiate the actual Office Balloon object and set up the balloon constants

Assistant.visible = True
Set bln = Assistant.NewBalloon

With bln
  .BalloonType = BalloonType
  .Icon = BalloonIcon
  .Button = BalloonButton
  .Heading = BalloonHeader
  If Not IsMissing(BalloonText) Then
    .Text = BalloonText
  End If

And now we come to the setting of the Balloons mode and the actual display of the balloon using the show method.

.Mode = msoModeModeless
.Callback = BalloonSub
.Show

Which leaves the confusing CallBack method which is where you have to define a public subroutine that handles the closing down of the Balloon object. This must be setup exactly as follows.

Public Sub closeBalloon(bln As Balloon, _
  lbtn As Long, lPriv As Long)

bln.CLOSE
Set bln = Nothing
Assistant.visible = False

End Sub

My initial thoughts on this subroutine were to include it in the Balloon Class module as a public subroutine but alas this was not allowed as the callback does not recognise subroutines in Class Modules. So now I store this subroutine in one of the general modules that I usually add to all my applications. As for process of CallBack functions, the notes in MSDN 2000 indicate that they are available from DLL functions that seem to have been written by Microsoft. So you probably won’t write one of those in a hurry.

The Access Balloon Wizard

A really useful alternative to using the Balloon class library that I provided is to download the Access 97 Balloon builder wizard. This is show in figure 3 and really is a good way to add and learn more about the Balloon object. The wizard installs like any Access wizard and has a file name of wzBln97.mde I could not find a Access 2000 wizard that did the same thing.

http://support.microsoft.com/support/kb/articles/Q172/1/82.asp

 

Figure 3 The Access 97 Balloon Builder Wizard in action (click picture to view)

 

Its Time To Let The Air Out Of The Balloon

Having deployed the Office Assistant Balloon in a couple of busy applications over the last few months, my conclusions on the technology are simple. Use the Balloon to inform users in situations where it would be useful to actually keep the information on the screen whilst still interacting with your Access Application. The balloon lets you do this. Do not over utilize the balloon for simple messaging or its impact will be lost when you really need your messages to be read. I make sure that I put a date test on my messages so that they are not displayed too many days after they are first posted. And finally be really wary about using the user input management features of the Balloon object, as one of the hallmarks of good user interface design is consistency and Access forms and the Balloons do not look the same !!

Garry Robinson

 

Useful Further Reading and Resources

You can find a number of good online resources for managing the Balloon at the following address.

Access Unlimited - Issue 21

The balloon and Office XP ( Turn it back on again )

Access Unlimited - Edition 26

Probably the best page on the Microsoft site where you can easily pickup all the Access 97 & 2000 downloads is

http://www.microsoft.com/downloads/search.asp

Included in these downloads are lots of different Balloons (search for Assistant) such as  Earl and Scribble the Cats, Mother Nature and you may even find Bruce the Kangaroo if you are lucky.

 

Author Bio.
Garry Robinson is the founder of GR-FX Pty Limited, a company based in Sydney, Australia. If you want to keep up to date with the his latest postings on Access Issues, visit his companies web site at http://www.gr-fx.com/ or
sign up for his Access email newsletter here. If you like the approach Garry took on this article, why not try out the Automation Class libraries that Garry offers at his website. When Garry is not sitting at a keyboard, he can be found playing golf or flying hot air balloons in the deserts of Australia.

http://www.pinpub.com is where you can sign up for newsletter and magazine that I use for most of my new Access Knowledge.

 

Other Pages On This Site You Might Like To Read

Save Reports As PDF Files From Access
Tuning Up Your Design Toolbars In Access 2000/97

  Click here for the download file if you own "The Toolshed"  Else click here   

 

This article first appeared in the May 2001 Edition of Smart Access. Reprinted with permission from Pinnacle Publishing   (http://www.pinpub.com/).

and was written by Garry Robinson from GR-FX Pty Limited

Click on the following button Next Tip to jump to the next page in the document loop.

 

Links >>>  Home | Search | Workbench | Orders | Newsletter | Access Security | Access professionals