Refresh ListBox while running code

Greetings all.

windows xp.

Is there a way to show and refresh a listbox while the code is running
that updates it? I have a search form that allows a user to enter a
part number or part description and search for first match or all

if the user selects the part description and chooses to search for all
matches, I would like for the listbox to appear on the form and update
as the records appear in the temp table. I would then like to add a
command that would allow the user to stop the search if they see what
they need appear in the listbox.

Any help would be appreciated.


My code:

Private Sub cmdSearch2_Click()
'On Error GoTo errClear

Dim i As String

i = frmPartsList.txtSearchCriteria.Text

frmPartsList.lblGetHCode.Visible = False
frmPartsList.lblHCode.Visible = False
frmPartsList.lblHCode2.Visible = False
frmPartsList.lblPart.Visible = False
frmPartsList.lblPartNum.Visible = False
frmPartsList.lblPartNum2.Visible = False
frmPartsList.lstParts.Visible = False

'Clears previous temp table
    Select Case cmbSearchBy
        Case Is = "Product Description" 'If searching by desription
            LastRow = Cells(Rows.Count, "gm").End(xlUp).Row
            With Worksheets("Data").Range("gm6:gm" & LastRow) 'with
descrip column
                Set C = .Find(What:=i, LookIn:=xlValues,
lookat:=xlPart) 'find search text
                If Not C Is Nothing Then
                firstAddress = C.Address
                    Do 'Keep looking until found all
                        ' Update my temp table with results
                        Set myRow =
                        frmPartsList.Caption = "Searching... " &
(myRow.Row - 4) & " matches found so far..."
                        myRow.Offset(1, 0).Value =
Range(C.Address).Offset(0, -2).Text
                        myRow.Offset(1, 1).Value =
Range(C.Address).Offset(0, -1).Text
                        myRow.Offset(1, 2).Value =
                        Set C = .FindNext(C)
                    Loop While Not C Is Nothing And C.Address <>
                End If
            End With
        Case "Part Number" 'same as code above except looking at number
            LastRow = Cells(Rows.Count, "gm").End(xlUp).Row
            With Worksheets("Data").Range("gm6:gm" & LastRow) 'with
descrip column
                Set C = .Find(What:=i, LookIn:=xlValues,
                If Not C Is Nothing Then
                firstAddress = C.Address
                   frmPartsList.Caption = "Searching... " & (myRow.Row
- 4) & " matches found so far..."
                        Set myRow =
                        myRow.Offset(1, 2).Value =
Range(C.Address).Offset(0, 2).Text
                        myRow.Offset(1, 1).Value =
Range(C.Address).Offset(0, 1).Text
                        myRow.Offset(1, 0).Value =
                        Set C = .FindNext(C)
                    Loop While Not C Is Nothing And C.Address <>
                End If
            End With
    End Select
    If C Is Nothing Then MsgBox Prompt:="There are no parts listed" & _
                        " that match your search.", Buttons:=vbOKOnly

    If Not C Is Nothing Then frmPartsList.lstParts.Visible = True
    If Not C Is Nothing Then frmPartsList.lblPartNum.Visible = True
    If Not C Is Nothing Then frmPartsList.lblPartNum2.Visible = True
    If Not C Is Nothing Then frmPartsList.lblHCode.Visible = True
    If Not C Is Nothing Then frmPartsList.lblHCode2.Visible = True
    If Not C Is Nothing Then frmPartsList.lblPart.Visible = True

    LastRow2 = Cells(Rows.Count, "go").End(xlUp).Row
    frmPartsList.lstParts.RowSource = Sheets("Data").Range("go6:gq" &
    frmPartsList.Caption = "Parts List Search"

Exit Sub

    frmPartsList.Caption = "Parts List Search"
End Sub

ADraughn (8)
6/14/2006 5:03:01 PM
excel 39879 articles. 2 followers. Follow

0 Replies

Similar Articles

[PageSpeed] 1


Similar Artilces:

Hi, I am trying to create one customized ListBox. 1) I have one CStatic as ListBox container and it holds one ListBox which is object of CListBox and one customized ScrollBar. 2) The picture is like, when I click on one button (which is on a dialog) , list box appears. 3) I also have some other controls on the same dialog. Now my problem is whenever I click on the portion of listbox which is overlapping with other controls it gets hide. wrote: > Hi, > I am trying to create one customized ListBox. > 1) I have one CStatic as ListBox container an...

Running a macro from a cell formula
I want my cell to have the formula =if(A1=1,<run-macro>,) If a macro <run-macro> exists, what's the syntax to have the formula run it? I answered this somewhere today Use a worksheet change event by right click on sheet tab>view code>insert this>modify>save Private Sub Worksheet_Change(ByVal Target As Range) If Target.Address <> "$F$1" Then Exit Sub Call mysub End Sub Sub mysub() MsgBox "Hi" End Sub -- Don Guillett SalesAid Software "Hall" <> wrote in message news:eYZ5yIywDHA.2408@tk2msf...

adding lines of code to a macro to delete rows
Hello: As the last step of a macro that I have written, I need all rows at the end of this spreadsheet to be deleted. (The rows at the end of the spreadsheet have bogus data, and I need to get rid of all of those rows and leave just rows of "real" data--long story short.) Specifically, the row after the last row of "real" data is a cell in column A that simply contains the word "Grand". How do I put in code at the end that says "delete all rows at the end of this spreadsheet beginning with this last row that contains just the word 'G...

VBA code not working on other PC
I am using Excel 2003 and I have been using the VBA code below on my computer for a long time and find it extremely useful and which has never result in an error. A colleague asked if he could also have in on his computer and so I copied it over. The strange thing is it doesn't seem to work on his computer and I not sure why. I stops on the line 'Dim Result As New DataObject' that I have higlighted with the *********. and a dialogue box appears saying: Compile Error: User defined type not defined. Does anyone know the answer why it works on my PC and not on his? I...

Outlook will not run an start up as a scheduled task
I have set up Outlook 2003 as a schduled task to run at start up. It doesn't run because "the scheduled task did not run because an incorrect password or user name was entered". I have not created any password in Outlook. Any ideas? Pete Outlook is not suitable to run from the Windows task scheduler. If you want it to run at Windows startup, add a shortcut to Outlook.exe to the Programs | Startup group. -- Sue Mosher, Outlook MVP Author of Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers

Error Code 0x80072EFF
I had some problems wit Trojan.Gadja.Injected that ruined the file Userinit.exe. I ran sfc /Scannow and then MalwareBytes and everything dissapeared. But I still can't access the Windows Update site, neither through the Icon in Windows or through the Microsoft Webpage. Everything that has Windows update int the address-feild opf IE8 ends up on a page where it sais it can't be shown. I notice that ther is a warning down to the left in IE8. Error on page. Soem Java script error perhaps. The Windows Defender gives me the same erroro code when I try to update the files. ...

Listbox scrollbar disappears
I have a program that periodically sets the contents of a listbox. After the program runs for some time, the vertical scrollbar is no longer painted (but otherwise still works). I wrote a small dialog based MFC application that reproduces the problem. The dialog contains a list box control and a button control. Selecting the button control fills the list box with 10 items 10000 times. Here is the button code that reproduces the problem for me: void ClbtestDlg::OnBnClickedButton1() { // TODO: Add your control notification handler code here for (int idx1=0; idx1<10000; idx1...

debug assertion when calling CAsyncSocket Create in native code from external managed C++/CLI wrapper
I found a thread here that describes my exact problem and a solution, but I still cannot get it working. This is the thread: I have an unmanaged C++ shared mfc extension dll, and I have created a managed shared mfc C++/CLI wrapper to be able to access it's functions through a C# application. Within the unamanged dll is a call to CAsynSocket Create, and when I invoke this call through my C# app -> C++ wrapper -> C++ dll, I get a debug assertion that shows at the top of the call stack AfxGetInstanceHandle. ...

Error when running Z report
When I generate the report I get the initial filter screen, and when I click ok to view the report, I get the following error message: "The report could not be loaded due to the following error: (-2147217900) Cannot truncate table 'Cashier' because it is being refrenced by a FOREIGN KEY constraint. Hey Daniel did you ever got that problem fix with the Run-Time Error "2147217900" Cannot truncrate 'Cashier' becuase it belong to a foreign key. If so, Can you tell me how to do it Thanks Robert. "Daniel" wrote: > When I generate the report I get...

How do I run outlook for the first time, to get the mail icon?
I want to set up multiple email accounts. Help menu indicates start - control panel - user accounts - mail, with a note that the mail icon will only appear after program is run first time. Basically, how do I get to see the mail icon? The mail icon should be in the control panel as soon as outlook is installed but you can go to the outlook shortcut on the Start menu, All programs, Microsoft Office to run outlook. -- Diane Poremsky [MVP - Outlook] Outlook Tips: Outlook & Exchange Solutions Center: Outlook Tips...

Multiform coding problem
I believe that I'm close but can't seem to get it right. What I want to do is to control the visibility of ComboBox's and Labels on Multiforms. Am I close? cmbEDU is the name of the first ComboBox on the Multiform. I'm not sure if I need to note that this code is not on the Multiform itself. Private Sub cmbProdSeries_Change() cmbProduct.RowSource = "" cmbProduct.Text = "" Select Case cmbProdSeries.Text Case Is = "Experience Life" cmbProduct.RowSource = "inpELProducts" lbl...

Exmerge on Running Information Store
Can we use Exmerge on current running production Information store to export a particular user's mailbox? His account has been disabled? will this be a problem? Or export has to be done from a recent backup? if the account is disabled, you won't be able to run exmerge against it...unless you add some permissions...or you could just re-enable the account, but expire it, instead...then you can run exmerge against it... -- Susan Conkey [MVP] "Mallik Vatti" <> wrote in message

Need Help with Coding a ComboBox in Excel/VBa......
Hi all, Perhaps someone can help me.......... I have the following code written in VBA. Private Sub SupervisorComboBox_Change() Sheets("Sheet2").Range("C1") = SupervisorComboBox.Value I have a ComboBox that lists ten supervisors. When the user chooses a supervisor from the ComboBox drop down list the name gets stored on the second Sheet, in cell, "C1". Now then.......there is a second ComboBox underneath this first one This ComboBox lists each employee that works under the chose supervisor. The employee's name gets stored in cell, "D1" My que...

Formulas to run offline in 3.0?
Hi CRM Pros I have a prospective 3.0 customer. Basically they have a not too complex Excel sheet, that they would like to replace with CRM functionalty instead, in order to run it offline with automatic sync to the CRM server. I know that I can customize CRM 3.0 with extra fields on the oppertunity entity and with custom exchange rate and freight rate tables. But what are the possibilities in 3.0 of creating calculations to run automatically, e.g., tallying the sum of some of the custom fields, or for multiplying some of them together with the exhange rate from a separate table? These calcula...

My Outlook 2003 is running very slow, why?
slow start up, program not responding, slow when changing views. Freezes when scrolling in month view, ect ect "com" <> wrote in message > slow start up, program not responding, slow when changing views. Freezes > when > scrolling in month view, ect ect Mailbox big? Try some archiving. Tools, Mailbox cleanup.Have you ran disk checking tools like chkdsk/scandisk/defragmenting? Other than that you haven't really given very much to work on ..... "Alan" <al...

How to run the merged EXE file?
There are 2 EXE files A and B, merge B into A using ILMerge. How to launch B in A? Thank you. "yxq" <> wrote in news:Oc9UYIzcKHA.4880 @TK2MSFTNGP05.phx.gbl: > There are 2 EXE files A and B, merge B into A using ILMerge. > How to launch B in A? Thank you. Do you mean you are merging two DLLs using ILMerge that each have an entry point? If so, you are moving outside of the scope of what ILMerge is designed to solve. ILMerge is a packager, so you have a single assembly. It is designed primarily to do one of the following: 1. Merge ma...

Multiple ListBoxes, OptionButtons, Check Boxes Etc.
I would like to place multiple ListBoxex, Option Buttons, or Check Boxes etc. on a sheet. When I do that, they seem to all interact with each other and I can't figure out how to make them act independently. Two check boxes are Ok since one can be "yes" and the other "no" for instance. I would like to have a large list of items and the user can select only the ones they want to use, which in turn will create a "sub list" if you will. I'm open for ideas on doing it some other way than list boxes, check boxes or whatever also. Any ideas? Thanks in a...

product code
I had to reformat my hard drive, I tried to install Offic Professional 2003 and it ask for the product code. I entered it and office installed, the first time I went to Word it ask for the product code again, when I entered it it says it is invalid. Is there a different product code. this newsgroup answers questions about building form objects in MS Access relational database software. suggest you repost your question to a more appropriate newsgroup, perhaps Office2003 or Word. hth "lmakm" <> wrote in message news:B8B3B4AF-B0B1-4FA0-9E54-7...

Correcting customer address codes or shipping addresses
My client is on Dynamics GP v9 and has been using Dynamics since 2001. It's been 7.5 years since they started using this software program. During this time, they have had several different people create customer cards etc and there are now several duplicate addresses for the same customer (same account ID but just identical addresses with a different address code for that customer). They are wanting to clean up this database. They are preparing to use the modifyer and combiner to combine customers that have two different account numbers but what is the BEST WAY to remove the dup...

i need to have more text options in a running writting font
I have to format a logo from a hand written sign. The text "Script MT Bold" is quite acceptable but the 'f' needs to have a loop on the bottom not on the top. The dot above the 'i' needs to be round not square. Is there any way I can develop the text that I need or change the actual letters? I have done the work in 2003 Publisher. I use Brush Script MT and the letters are properly portrayed. The loop for the "f" is on the bottom and the dot over the "i" looks rounds. If I can be of help, send me a note to: dschmidt AT pacifier DOT com -...

Form code runs too quickly
I have the following code attached to my form - works fine other than when the form is first opened. If the third "if" is true, the code runs before the form is even open! Any way to have the form open first before the message box displays? Just one more small point - what syntax do I use to have the message in the message box show on two lines and also have double quotes around "Job Complete" (as I have just typed)? Private Sub Form_Current() If IsNull(txtDateCollected) Then Me.lblJobComplete.Visible = False Me.chkJobComplete.Visible = False ...

vba code for excel to extract data from txt file
USING Excel 2000. I have a text file that when viewed in excel lists the entire row of data in one cell. I cannot parse data because each line does not have the same break. I want to extract the fields into individual cells. I will need to define "what" I am looking for. Is there sample vba code for excel I can reference to learn how this may be done? sample report REF #:A1B CUSIP:12345678 TD:1/1/00 SYMBOL:ABC QTY: 1 SD:01/03/00 ACME COMPANY PRICE: 9.101 MKT:OTC want to extract REF# TD ...

Exmerge won't run
I can't get Exmerge to run on our new Exchane03 server with sp2. It gets to the point where it check for the list of mailboxes and just sets there. It just doesn't retrieve them, Any ideas? OK, I get an error "Error opening message store". I am running this as an enterprise admin. What is going on? "Brandon Baker" <> wrote in message news:uW5uPsLMGHA.2916@tk2msftngp13.phx.gbl... >I can't get Exmerge to run on our new Exchane03 server with sp2. It gets to >the point where it check for the list of mailboxes ...

How To Refresh tree
Hi I am beginer in vc++,I am performing the drag and drop operation from left pane tree control to Right pane list control which contain Tree Item , for that i use three events whose event handler OnBiginDrag() OnMouseMove() OnLButtonUP() I am showing here Item Image is dragging from left tree control to right List control; Its fine . now I am performing DataBase operation to insert drag item into Dorp Postion. and Call DeleteallItem() function then I call InitLeftTreeItem() fuction that extract the data from data base and Display it on Tree . in onLButtonUP() function after performini...

How to write code to check if MSFlexGrid.ocx was registered
I'm using msflexgrid. How do I write code to check to see if the client computer has msflexgrid.ocx register (or class CMSFlexGrid is not available), because if not I need to do something else Thanks! You may want to use CoCreateInstance to see if it exists. You'd get a REGDB_E_CLASSNOTREG code if it doesn't. <> wrote in message > I'm using msflexgrid. How do I write code to check to see if the client > computer has msflexgrid.ocx register (or class CMSFlexGrid is not > availa...