problem with event

Posted on 2007-07-30
Last Modified: 2010-04-30
Hello group,

I'm using event of a Combbox (drop-down menu) to manage some operations:

1) ListIndex = 0 Nothing and its text is Blank
2) ListIndex = 1 and its text is "Create a new report"

From ListIndex > 1 all existing records are started meaning that when user selects one of them all associated data/parameters are retreived and shown in
their edit boxes.


Assume user selects index  = 2 and then he changes report name and then switches or chooses
a different report, by selecing index = 3 or any; since there has been modification applied so program
shows confirmation to save or not to save the changes.
Problem is that I need to referesh the drop-down menu to show the updated report name however, since I'm doing all these on Click() event of the drop-down
menu it loses the next index it was going to switch.

Of course I can save it in a variable and assign it back like :

comb1.listindex = stored_index

but this will cause the confirmation to show up twice.

What can I do?


Question by:akohan
    LVL 10

    Expert Comment

    I dont remember if the .list(INDEX) is a read only or not...

    you can try comb1.list(comb1.listindex) = "TEST"

    if that dont work, you can consider deleting a certain row, and inserting a new one at that location. I thin combobox has .remove and .additem functions? (It should be the same as a list box)

    Author Comment



    You mentioned using
                 comb1.list(comb1.listindex) = "TEST"

    How can I make the system ignore its event by using above statement?

    LVL 10

    Expert Comment

    changing the text does not trigger the OnClick event?
    LVL 76

    Accepted Solution

    I can't pretend to understand exactly what your situation is, but if you want an event to be ignored once, you can use a global or module-level boolean parameter.

    Dim bHoldoff as Boolean

    Sub Something()
        comb1.list(comb1.listindex) = "TEST"
        bHoldOff = True
        'code for refreshing
        bHoldoff = False
    End Sub

    Sub Comb1_Click()
       If Not bHoldoff then
             'code for processing
    End Sub

    Author Comment


    Thanks indeed.


    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    Join & Write a Comment

    Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
    You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
    Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
    Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now