Solved

cleaning a LisIndex -1

Posted on 2003-12-10
4
241 Views
Last Modified: 2010-05-18
Hi, I have a form in Visual Basics. when this form loads it fills a combobox and this info comes from an Access databases. Also when you click this combobox it displays the description of the selection in another textbox.
and then when i save a record i want the form to clean up all textboxes and comboboxes.  so i tried to write after the save statement "cbobox.listindex = -1" but it doesn't work.  because it goes back to the click statement. do you know what i can do..
hopefully i made myself clear. please let me know if you need a better explanation. Thanks a lot.
0
Comment
Question by:mapy
  • 2
4 Comments
 
LVL 6

Expert Comment

by:srimanth
ID: 9913879
try:

cbobox.clear         'Clears the ComboBox
textbox.text = ""   'Clears the textbox

cheers,
srimanth.
0
 
LVL 14

Accepted Solution

by:
aelatik earned 500 total points
ID: 9913883
'Make a boolean var like CLEANING

Dim CLEANING As Boolean

' In your click event check for that var before activating

Private Sub cbobox_Click()
    If CLEANING = False Then
        ' Exucute your code
    End If
End Sub

' When your clearing the listindex set CLEANING to true and the click event won't execute
' When done just set the CLEANING var to false and the click event will work again.
0
 
LVL 14

Expert Comment

by:aelatik
ID: 9913894
Now im confused, do you mean clearing the controls or setting it to its begin value ( deselecting everything )
0
 

Author Comment

by:mapy
ID: 9914993
yes, after saving a record i want to set it up to its begin value.
thank you all, but aelatik is right.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

713 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