+ Reply to Thread
Results 1 to 42 of 42

Search an Excel Database and display results w/ pictures.

Hybrid View

  1. #1
    Registered User
    Join Date
    05-28-2007
    Posts
    28

    Unhappy Search an Excel worksheet and display results w/ pictures.

    Hello,

    I have very little experience with programming, as a matter of fact the code in the sample file is the extent of my knowledge. I want to use Excel because not everyone in the plant has access to Access, but everyone has Excel.

    The idea is to allow searching for parts based on 2 different part numbers, category, drawer, manufacturer, or description (any or all).

    My first problem is how to make excel search using a userform and find multiple results, not just stopping after it finds the first match. For instance if you only searched for a category it should find all results that match that category.

    (I'll try to anticipate a question here: the part numbers should be unique but may not be, so using the part number as a key will not work.)

    The second thing is I would like to know how to populate these results in a listbox and and have the selected part show the matching picture. (This maybe more clear after seeing the spreadsheet).

    And finally, is there any way to make the comboboxes on the search userform populate themselves off of the list of data.

    I apologize if any of these questions have been answered already but frankly I've been searching google for the past week and haven't found anything, (This may attest to my search skills as well, ha ha ha), and I really just want this to be finished.

    Any and all help much appreciated!

    -L

    Sorry had an upload error with the file, should be OK now.
    Attached Files Attached Files
    Last edited by Schmoozer; 05-28-2007 at 06:38 PM.

  2. #2
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591
    Hi

    Have a look at the attached.

    1) I've only used the category as an example.
    2) Data sheet now has 4 entries for a category of test2.
    3) Category is loaded at the form initialization stage
    4) I've used an advanced filter to extract the relevant information
    5) The output is now a 7 column listbox, that shows the results of the filter.

    Open the form, select search for a part, then select test2 from the Category dropdown, press search and the relevant items should show up in the output form.

    Hope this gives you some ideas on how to proceed.


    rylo
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    05-28-2007
    Posts
    28

    Thumbs up

    Wow, thanks Rylo!

    OK first, for the combo box

    Yours worked great, but when I tried to transfer it over to the original worksheet I don't get an error but the comboboxes are empty, any thoughts?

    
    Private Sub cmbCategory()
      Dim DataSH As Worksheet, dicCat
      Set DataSH = Sheets("Data")
      Set dicCat = CreateObject("Scripting.dictionary")
      
      On Error Resume Next
      For i = 2 To DataSH.Cells(Rows.Count, 1).End(xlUp).Row
        If Not dicCat.exists(DataSH, Cells(i, 4).Value) Then dicCat.Add DataSH.Cells(i, 4).Value, DataSH.Cells(i, 4).Value
      Next i
      On Error GoTo 0
    
      Category.List = dicCat.items
    
    End Sub
    
    
    Private Sub cmbDrawer()
      Dim DataSH As Worksheet, dicDra
      Set DataSH = Sheets("Data")
      Set dicDra = CreateObject("Scripting.dictionary")
      
      On Error Resume Next
      For i = 2 To DataSH.Cells(Rows.Count, 1).End(xlUp).Row
        If Not dicDra.exists(DataSH, Cells(i, 5).Value) Then dicDra.Add DataSH.Cells(i, 5).Value, DataSH.Cells(i, 5).Value
      Next i
      On Error GoTo 0
      
      Drawer.List = dicDra.items
    
    End Sub
    
    
    Private Sub cmbManufacturer()
      Dim DataSH As Worksheet, dicMan
      Set DataSH = Sheets("Data")
      Set dicMan = CreateObject("Scripting.dictionary")
      
      On Error Resume Next
      For i = 2 To DataSH.Cells(Rows.Count, 1).End(xlUp).Row
        If Not dicMan.exists(DataSH, Cells(i, 7).Value) Then dicMan.Add DataSH.Cells(i, 7).Value, DataSH.Cells(i, 7).Value
      Next i
      On Error GoTo 0
      
      Manufacturer.List = dicMan.items
    
    End Sub
    Last edited by Schmoozer; 05-28-2007 at 08:47 PM.

  4. #4
    Registered User
    Join Date
    05-28-2007
    Posts
    28

    Talking $$$

    Okay this really does need to be done tonite.

    So if anyone can have it working tonite I'll paypal you 20 dollars once i confirm it works at work tomorrow.

  5. #5
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591
    Hi

    The code needs to go into the form initialization event.
    Or are you calling the subs from there?


    rylo

  6. #6
    Registered User
    Join Date
    05-28-2007
    Posts
    28
    I'm not quite sure what you mean by that, so probably not...

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1