Above Header LeaderBoard <body> <!--Google Navigation Bar--> <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>
Header Right Columns
www.msaccesstips.com

LEARN MS-ACCESS TIPS AND TRICKS

Home

LEARN MS-ACCESS TIPS AND TRICKS

↑ Grab this Headline Animator

Your Ad Here
Friday, February 01, 2008

Office Assistant with Check Box Menu

We have seen the usage of Office Assistant for Message Boxes and Message Box with Options Menu in the earlier Article.


Like I said before, when we design Applications there must be something different in it better than what we did earlier, better and attractive to the User as well as to the outside world.


Data processing has its own importance and I am not overlooking it here. Every Application that we develop is different and a challenge in its own merit and we have to devise new methods or techniques to deal with the issues in them.


But, repeating the same type of Application design and using the same kind of controls like the Command Buttons or Message Boxes over and over again is a boring experience, to the developer and to the User as well. I think that is one of the reasons why Windows or Microsoft Office Applications comes out with more features and better looking Programs all the time.


We will try the Check Box type Menu Options in Message Box with Office Assistant. We will use the same sample Form that we have created for running the earlier program. An image of the run of the Program is given below:


program sample run image

If you have not tried the earlier example please read the Article on MsgBox with Options Menu and go through the preparations that I have mentioned there, in order to run the programs given here without errors.


I will be preparing sample databases on most of the Articles that I have published so far and will upload them into the site shortly, so that you can download and try them out instantly.


We have moved recently into our own site: www.msaccesstips.com and I am in the process of updating the site and dealing with the initial teething problems. Once that is over I will concentrate on the above task.



  1. Open the Form OptionCheck that we have created in the earlier example in design view.

  2. Create a second Command Button on the Form.

  3. Click on the Command Button to select it and display the Property Sheet (View -> Properties). Change the following property values as given below.


    • Name = cmdChk

    • Caption = Get Checked



  4. While the Form is still in design view, display the VBA Module of the Form (View -> Code).

  5. Copy and paste the following Code into the VBA Module of the Form and save the Form.


  6. Private Sub cmdchk_Click()
    Dim OptionArray(1 To 5) As String
    Dim i As Integer, msg As String, title As String

    OptionArray(1) = "Display Report Source Data"
    OptionArray(2) = "Print Preview"
    OptionArray(3) = "Print"

    msg = "Please Select an Option"
    title = "Report Options"

    i = MsgGetChk(msg, title, OptionArray())

    If i > 0 Then
    Me![optTxt] = i & " : " & OptionArray(i)
    End If

    Select Case i
    Case -2
    msg = "Cancelled"
    Me![optTxt] = i & " : Cancelled"
    Case 1
    'DoCmd.OpenForm "myForm", acNormal
    msg = "Display Report Source Data"
    Case 2
    'DoCmd.OpenReport "myReport", acViewPreview
    msg = "Print Preview"
    Case 3
    'DoCmd.OpenReport "myReport", acViewNormal
    msg = "Print"
    End Select

    MsgOK "Selected: " & msg

    End Sub



    This is a copy of the same Program that we have used for Baloon Type Options which is already there in the Form Module. I have made changes in two places in the Code to use it for this example.


    • Number of elements in the OptionArray() Variable reduced to three after removing the Cancel item, because the OK and Cancel Buttons will be included in the main program.


    • Included testing for the Cancel condition in the Select Case…End Select statements and terminates the program if the User clicks on the Cancel Button. When you implement this method into your Project you can remove the Case -2 and next two statements underneath it. Here it is inserted for demonstration purpose only.



  7. Copy and paste the following main program into a Global VBA Module in your Project and save it.



  8. Public Function MsgGetChk(ByVal strText As String, _
    ByVal strTitle As String, ByRef obj) As Integer
    Dim X As Integer, i, c As Integer, k As Integer
    Dim Bal As Balloon, vSelect As Integer

    On Error GoTo MsgGetChk_Err

    Set Bal = Assistant.NewBalloon
    i = 0
    k = UBound(obj)
    k = IIf(k > 5, 5, k)

    For X = 1 To k
    If Len(obj(X)) > 0 Then
    i = i + 1
    End If
    Next

    ForceEntry:

    With Bal
    .Animation = msoAnimationWritingNotingSomething
    .Icon = msoIconAlert
    .Heading = strTitle
    .Text = strText
    .BalloonType = msoBalloonTypeButtons
    For X = 1 To i
    .Checkboxes(X).Text = obj(X)
    Next
    .Button = msoButtonSetOkCancel
    vSelect = .Show

    If vSelect = -2 Then
    MsgGetChk = vSelect
    Exit Function
    End If

    c = 0
    For X = 1 To i
    If .Checkboxes(X).Checked Then
    MsgGetChk = X ' get the item checked by the user
    c = c + 1 'more than one item checked
    If c > 1 Then
    Exit For
    End If
    End If
    Next

    If c > 1 Then
    strText = "Select only one item. "
    GoTo ForceEntry
    End If

    If c = 0 Then
    strText = "Select one of the Options or Click Cancel! "
    GoTo ForceEntry
    End If

    End With

    Assistant.Visible = False

    MsgGetChk_Exit:
    Exit Function

    MsgGetChk_Err:
    MsgBox Err.Description, , "MsgGetChk"
    Resume MsgGetChk_Exit
    End Function


    This main program is almost same as the Options Menu that we have used for our earlier example. The statement .labels(X).Text = MaxArray5obj(X) changed to .Checkboxes(X).Text = obj(X). Added few more lines of code to check, whether the User

    • put check marks in more than one item, if so, forces to select one item only.

    • clicked OK Button without selecting any of the Options. If so, asks to select one of the options before clicking OK Button and suggests clicking Cancel Button if there is a change of mind.



  9. If the office Assistant is not visible, turn it on, Help - > Show the Office Assistant or press Alt+H followed by Alt+O.


  10. Right-Click on the Office Assistant and select Choose Assistant. Click on the Next or Back Button to select the Office Cat Character.


  11. The program works with any Office Assistant Image but the initial Animation Type: msoAnimationWritingNotingSomething set in the Program works fine with the Office Cat and I love the Office Cat.

  12. Open the OptionCheck Form in normal View. Click on the Get Checked Command Button. If every thing went through well you will see the Office Assistant with Check Boxes as shown in the image at the top.


  13. Try clicking the OK Button with check marks in more than one item. Try clicking OK Button without putting check mark in any of the options.






Download Demo Database




Configure Outlook for Lotus Notes
MS-Access and Email
Dynamic Report
MS-Access & Mailmerge-3
MS-Access & Mailmerge-2

Labels:

0 Comments:

Post a Comment

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

Links to this post:

Create a Link

<< Home

Page Footer

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

Sidebar Left
   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
 

Sidebar Right Top



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: Ruwi, Oman


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.


Sidebar Right Top

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