?
Solved

problem with event

Posted on 2007-07-30
5
Medium Priority
?
159 Views
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.

Problem:




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?

Regards,
ak













0
Comment
Question by:akohan
  • 2
  • 2
5 Comments
 
LVL 10

Expert Comment

by:sakuya_su
ID: 19597712
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)
0
 

Author Comment

by:akohan
ID: 19597957


Hi,

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

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

Regards,
ak
0
 
LVL 10

Expert Comment

by:sakuya_su
ID: 19598154
changing the text does not trigger the OnClick event?
0
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 2000 total points
ID: 19598307
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
    DoRefresh
    bHoldoff = False
End Sub

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

Author Comment

by:akohan
ID: 19648496


Thanks indeed.

Regards,
ak
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…
Suggested Courses
Course of the Month13 days, 13 hours left to enroll

807 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