Solved

cleaning a LisIndex -1

Posted on 2003-12-10
4
239 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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Access 2016 VB code 9 115
Restricting text box entry from \/:?<>"| 9 87
Specify ip address in my connection string for sas 2 60
VBA Shell can't Find Word document 11 94
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…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…

809 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