Closed Thread
Results 1 to 21 of 21

Search through database and display results in userform

Hybrid View

karthikcoep Search through database and... 01-17-2009, 01:33 PM
Leith Ross Hello karthikcoep, You can... 01-18-2009, 05:01 AM
MickG Hi, I can't compete with... 01-18-2009, 08:55 AM
lyzieaa_mkj88 Search & Display records on... 08-18-2011, 04:21 AM
royUK See the database form example... 01-18-2009, 03:07 PM
Leith Ross Hello karthikcoep, If you... 01-18-2009, 04:51 PM
karthikcoep Thank to everyone 01-20-2009, 11:10 AM
karthikcoep Sorry need some change 01-22-2009, 02:48 PM
arthurbr Re: Search through database... 10-11-2011, 05:10 AM
gkaty28 Re: Search through database... 05-24-2012, 04:10 AM
arlu1201 Re: Search through database... 05-24-2012, 05:08 AM
  1. #1
    Registered User
    Join Date
    12-20-2008
    Location
    Mumbai
    MS-Off Ver
    Microsoft Office 2003 and 2007
    Posts
    36

    Search through database and display results in userform

    I have a database of 13 columns and ever increasing rows.
    I want the following to be there on my userform.


    1 combobox:
    showing the list of categories from which to search.(The categories are the column headings in columns A1 to A13.The user will have to select one category.

    1 textbox:
    Here the user will enter the search term.

    1 Command Button:
    When the command button is clicked/entered, the code shall be such that it will search in the column corresponding to the category mentioned in the combobox and display the results( The entire 1 row x 13 cloumns containing the search term) in a Listbox. If the search term does not matches then a message box should appear with the message "No entries found"
    [B]


    1 Listbox:to display the search result as mentioned above.

    Thanks in advance for the help
    Last edited by karthikcoep; 01-29-2009 at 02:45 AM. Reason: Solved

  2. #2
    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,

    You can copy your data onto "Sheet1" of the attached workbook. Since it searches the active sheet, no need to worry about changing the sheet name. All 13 columns are visible in the ComboBox and the ListBox. I enhanced the search features to include matching by case or ignoring case, match the whole word or only part, and do a single search or search for all matches. The UserForm also acts like a standard window. You can minimize and maximize it to and from the task bar. Let me know how this works for you.

    Sincerely,
    Leith Ross
    Attached Files Attached Files

  3. #3
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650
    Hi, I can't compete with Leith , but attached is a Simpler Version.
    Replace the test Data with your Data and also the column Headings (If there not too long !).
    Leith, Have you got a good starting point for API Calls ??
    Regards Mick
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    08-18-2011
    Location
    KL, Malaysia
    MS-Off Ver
    Excel 2003
    Posts
    1

    Search & Display records on userform

    Hi I am very new to Excel/VBA. I have created a "JV INFORMATION SYSTEM" in excel and have designed a user form for users to enter new JV iNFO.

    My next step is to design a Search or find form for viewing the JV Information where
    user can choose to look up for JV info either by Company Name or Project Name or Date

    The worksheet that stored my data is called "JV" . In the sheet "JV " I have following 10columns

    Column A -No
    Column B-Company Name
    Column C Project Name
    Column D- Start Date
    Column E- End Date
    Column F- Equity Ratio
    Column G- Company Address
    Column H-Contact Person
    Column I-Contact No

    I did see a few examples of look up forms but am struggling to customise them to suit me.

    Ideally I need a combobox & textbox in search field. So user can choose the "Search by" category using combobox e.g. Company Name or Project Name or Date
    and then enter the relevent text in the textbox to carryout the search.

    and then use labels & listbox to display the related fields on the form. The reason I prefer labels is that I do not want users to edit the info. and listbox to show multiple results out of which user can choose specific one....e.g. when user does a search by Company, I want listbox to show the various Information about that company or when user search by date e.2 by Year , all information related to that year is display in the list box .

    any help would be appreciated...thx in advance

  5. #5
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    See the database form example

    http://www.excel-it.com/vba_examples.htm
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  6. #6
    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,

    If you really don't need all the bells and whistles of a UserForm to find, replace, add, and delete entries, here is simple and direct macro that will launch Excel's built-in database editor.
    Sub Run()
        ActiveSheet.ShowDataForm
    End Sub
    Sincerely,
    Leith Ross

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

    Thank to everyone

    Hey thanks to everyone.Sorry for the late reply.
    @Leith: The file works well.

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

    Sorry need some change

    Hi Leith;
    Your form works pretty well.
    But I need it modifed.
    I have tried a lot but not able to do so.
    I want only the following.
    User selects a criteria from the combobox(Column 1 ro 13, Row 1)
    User types text in search field and then hits the search button
    In the list box all the results are listed. For each result there is only one single row.
    The top row of the listbox displays the 1row of the sheet.(That I can do)
    The results are displayed one below the other. So that the user need not use "prev" and "next".
    And the most important is when there are no results,a message box must pop up saying "No Results found".
    Thanks

  9. #9
    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 redone the UserForm. The ListBox has been replaced with a ListView control. The ListBox had to many limitations to do what you wanted. The version of this control works with Excel 2000 and up. If you plan to run this on earlier systems then some changes will have to be made to load the correct control. The searches are not case sensitive and match whole words only. All matches appear in the ListView with the row number and the values for columns "A" to "M".

    Sincerely,
    Leith Ross
    Attached Files Attached Files

  10. #10
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326

    Re: Search through database and display results in userform

    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.

  11. #11
    Registered User
    Join Date
    05-23-2012
    Location
    taguig
    MS-Off Ver
    Excel 2010
    Posts
    1

    Re: Search through database and display results in userform

    is it possible that the searched item can be link to a file? i want to link the search item directly to the file.

  12. #12
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Search through database and display results in userform

    Gkaty28,

    Welcome to the Forum, unfortunately:

    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. It makes sense to have a new thread for your question because a thread with numerous replies can be off putting & difficult to pick out relevant replies.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

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