Closed Thread
Results 1 to 21 of 21

Search through database and display results in userform

Hybrid View

  1. #1
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259
    Hello karthikcoep,

    I have made the changes to the attached workbook to search only the worksheet pointed to by Sheets(1).

    Sincerely,
    Leith Ross
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    12-20-2008
    Location
    Mumbai
    MS-Off Ver
    Microsoft Office 2003 and 2007
    Posts
    36

    NOt working

    Hello Leith,
    The file u sent is running fine,
    but when i export the userform and import it back to use in my file it is not working. The gridlines are not visible.There is not error but in the listview control only the row no is displayed and nothing else.
    Please help.
    I tried this on a blank workbook then also it is not working.

  3. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259
    Hello karthikcoep,

    The problem is the reference library isn't loaded on the other machines. The workbook I posted has the reference saved. I have added a macro that will automatically load the library reference when the workbook is opened. Here is the auto loading macro which is called by the Workbook_Open() event procedure. This macro is located in Module1.
    Sub AddListViewControl()
    
      Dim P As Variant
      Dim Paths As Variant
      Dim RefFile As String
      Dim X As String
      
        RefFile = "MSCOMCTL.OCX"
        
        Paths = Split(Environ("Path"), ";")
          For Each P In Paths
            X = Dir(P & "\" & RefFile)
            If X = RefFile Then Exit For
          Next P
      
          If X = "" Then
             MsgBox "The directory for " & RefFile & " could not be found."
             Exit Sub
          Else
             RefFile = P & "\" & RefFile
          End If
          
        On Error Resume Next
          Application.VBE.ActiveVBProject.References.AddFromFIle RefFile
          If Err = 0 Or Err = 32813 Then Err.Clear
        On Error GoTo 0
      
    End Sub
    Workbook Open Event - ThisWorkbook Module
    Private Sub Workbook_Open()
      Call AddListViewControl
    End Sub
    Sincerely,
    Leith Ross
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    12-20-2008
    Location
    Mumbai
    MS-Off Ver
    Microsoft Office 2003 and 2007
    Posts
    36

    Re: Search through database and display results in userform

    Thanks a lot Leith.
    May god bless u!!!!!!!!!!!!!

  5. #5
    Forum Contributor
    Join Date
    06-20-2007
    Location
    Buckeye, AZ
    MS-Off Ver
    365
    Posts
    298

    Re: Search through database and display results in userform

    Leith,
    you've come sooo close to solving an project that has stumped me for weeks!
    in my woorksheet (see attached) i'm trying to search list (M) and chose from search list to return to cell D5. "D5:D55" will have this ability. Can you take me this last step?
    thank you,
    sick
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    07-07-2010
    Location
    Montana, USA
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Search through database and display results in userform

    Hello Leith Ross, I found the program you wrote absolutly useful to a project that I am working on right now that has over 2500 product. I am wondering though, is there a way to change the code slighly to select the condensed data in the user box, and have it return to the worksheet highlighted. The only reason I would as Is that I would use a similar program so that the user could get to that row to access pdf forms that are embeded in each row? Any ensight would be lovely.

  7. #7
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Search through database and display results in userform

    Hello dmanatee,

    Please start a new thread. You can include the URL of this post as a reference.

    Your post does not comply with Rule 2 of our Forum RULES. Don't post a question in the thread of another member -- start your own thread. If you feel it's particularly relevant, provide a link to the other thread.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  8. #8
    Registered User
    Join Date
    10-11-2011
    Location
    dubai
    MS-Off Ver
    Excel 2007
    Posts
    1

    Re: Search through database and display results in userform

    we have 300 employee's details in sheet 1 (passport details / visa details/ labour details/ personal details/ salary details/ leave details) in sheet 2 need user form if i enter emp id then i have to get all details of emp. in sheet 2

Closed 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