Results 1 to 2 of 2
  1. #1
    3 Star Lounger
    Join Date
    Jul 2001
    Thanked 0 Times in 0 Posts

    Hoow tomake my control perfrom another action (Access 2000)

    How to make my code perfom another action if i do not choose a record

    I have a list box called MyListBox.This list box contains the number of my friends.
    Above the list box i have a control.In the OnClick event of the control i have the following function :

    Dim stLinkCriteria As String
    Dim stDocName As String
    stLinkCriteria = "FriendID = " & Me![MyListBox]
    stDocName = "Friends"
    DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria

    I want to use thus control to perform another function, say DoCmd.Beep, if i do not choose a friend
    from my list box.In this way i could make my control perform a dual function.First open a report if a choose
    a record from the list box, and second,perorm quite another function if i do not choose a record at all.
    What should i add to the above code in order to achieve this?

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Sacramento, California, USA
    Thanked 1 Time in 1 Post

    Re: Hoow tomake my control perfrom another action (Access 2000)

    You're going to have a problem because the Click event happens *after* the AfterUpdate event. Otherwise, it doesn't occur. So if you don't select a value in your listbox, the Click event never happens. That means that you can't make it behave the way you want to. You'll have to use an Exit or LostFocus event instead.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts