Solved

cleaning a LisIndex -1

Posted on 2003-12-10
4
242 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

738 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