Help with Assistant Balloon - Cancel (1 Viewer)

GaryC

Registered User.
Local time
Today, 16:32
Joined
Apr 25, 2001
Messages
31
Help please!

I want to use the "Office Assistant - Balloon object" to promt users for a selection and run the apprpriate code. The following routine works upto a point but I have a problem with the 'Cancel' button. If the user selects a check box then Clicks "Cancel" it still runs as if the user clicks OK. What changes do I need to make to interrogate the button pressed 'OK' or 'Cancel'. It does not seem to work like the MSGBOX() function. I am sure the answer is simple when you know how - but I can't find it in the help!


With Assistant.NewBalloon
.Heading = "Operation Selection"
.Text = "Select the required Operation"
.Checkboxes(1).Text = "Add a new record""
.Checkboxes(2).Text = "Edit an record"
.Button = msoButtonSetOkCancel
.Show
Select Case True
Case .Checkboxes(1).Checked
DoCmd.OpenForm "Add New Record Form", , , , A_ADD
Exit Sub
Case .Checkboxes(2).Checked
DoCmd.OpenForm "Filter_Select_Form"
Exit Sub
Case Else
'user pressed cancel - return to mainmenu
DoCmd.OpenForm "Main Menu"
Exit Sub
End Select
End With

[This message has been edited by GaryC (edited 07-02-2001).]

[This message has been edited by GaryC (edited 07-02-2001).]
 

D-Fresh

Registered User.
Local time
Today, 16:32
Joined
Jun 6, 2000
Messages
225
Your problem is your case statement. Select Case True will return the first value that is true... So even if cancel is pushed, it will check the two checkboxes to see if one of them is selected. If so, then it will run that code. You should check to see if cancel is selected before the Select Case statement. Hope this helps.

Doug
 

GaryC

Registered User.
Local time
Today, 16:32
Joined
Apr 25, 2001
Messages
31
Doug,

Thanks for that - I guessed that was probably the case - but I Couldn't find the syntax - but the penny has now dropped I needed to assign the .show to a variable then inspect the variable first.

Cheers


[This message has been edited by GaryC (edited 07-03-2001).]
 

accesswatch

Registered User.
Local time
Today, 16:32
Joined
Aug 12, 2000
Messages
72
I'm not sure if you are aware but (someone correct me if I am wrong) the Office Assistant (Clippy) is being dropped in Access XP. So your future upgrades may have to be recoded to take this into account.
 

GaryC

Registered User.
Local time
Today, 16:32
Joined
Apr 25, 2001
Messages
31
Accesswatch - you are partialy correct.

In Office XP 'Clippy' (and his friends) can be 'switched-off' and 'on' again. Unlike the current situation where they suddenly re-appear without being 'summond'.

In my case they will be 'OFF' - but many people like them - hence the original question. There is no accounting for (users) tastes!
 

Users who are viewing this thread

Top Bottom