Search values from textboxes to display results (row data) in Listbox from data in workbook

Newport Count

Active Member
Joined
Oct 25, 2009
Messages
328
Hi,

I have a userform (frmSearch) that I'm trying to set up to search for and then display/edit existing records from a workbook.


When the spreadsheet is opened, users see a small userform (frmOption) with 3 command buttons to either create a new record, exit the spreadsheet or amend/review existing record.

- The create new record button links to userform (frmAdjustmentTrackerForm) that is used to send data to a workbook called Tracker2 - this works well
- The exit spreadsheet button closes the spreadsheet - all ok
- The amend/review existing record button opens another userform (frmSearch), which I require help on!


The data in my workbook (tab name: Tracker2) is as follows:

Column A = Unique ID number (A1: header description: Unique ID)
Column B = Unique ID number (B1: header description: Column A = Date Entered)
Column C = Unique ID number (C1: header description: Raised by)
Column D = Unique ID number (D1: header description: Customer Name)
Column E = Unique ID number (E1: header description: Customer Number)
Column F = Unique ID number (F1: header description: Billed?)

In userform (frmSearch) I have a listbox set up (lstAdjustments) that needs to display the Tracker2 row data from the Unique ID (always numerical) that is entered into a textbox (txtUniqueID) - it should display when a command button is clicked (cmdUniqueIDSearch).
- Can the headers of the workbook also be displayed (rather than add Labels to the userform)? No big deal if too much effort required!

I have some code for when incorrect unique IDs are attempted to be searched and if non-numerical characters are entered into the textbox, so I'm ok on that front.


What I would also like to do is to search for another option in the same workbook area - Customer Name. I have a dropdown list of all potential customer names (cboCustomerName) and another separate command button to perform the search (cmdCustomerNameSearch). So when a customer name is selected, the details should display in the listbox.


For the details that then appear in the listbox e.g. a single piece of data relating to a unique ID search or multiple pieces of data relating to a customer name search - I would like the user to select one option and then click a command button to then send the contents of that particular unique ID to a different userform (frmAdjustmentTrackerFormUpdate), which will enable the user to display and amend the details as per the original userform that was was filled in before it was updated to the spreadsheet. This userform (frmAdjustmentTrackerFormUpdate) looks identical to the original form (frmAdjustmentTrackerForm) but will hopefully enable users to override the existing row data with whatever has been amended.


Any help on this would be really appreciated! I know there is a lot there, but I have probably read through 100s of posts on this stuff...it has been useful because I think I have understood the concept/layout of what I want to do, but the workings of the code is a different story for me!


I found this previous post really useful and I almost got it to work, but I have no idea what is going in the code - so amending it to suit my needs is proving near impossible! To make it work I had to move my Unique ID column from column B to column A - but the more I work on it, the less success I'm having.
http://www.mrexcel.com/forum/excel-questions/261815-fill-listbox-based-textbox-value.html


Cheers,
Rich
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Just spotted an error in the workbook data - it should read like this:

The data in my workbook (tab name: Tracker2) is as follows:

Column A = Unique ID number e.g. 3
Column B = Date Entered e.g. 30/10/2015
Column C = Raised by e.g. Rich
Column D = Customer Name e.g. ABC Ltd
Column E = Customer Number e.g. 10000123
Column F = Billed? e.g. Yes
 
Upvote 0

Forum statistics

Threads
1,214,793
Messages
6,121,614
Members
449,039
Latest member
Mbone Mathonsi

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top