Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run search from text box.

Status
Not open for further replies.

MkIIISupra

Programmer
Apr 17, 2002
108
US
I have a text box set up to receive errors found in a variety of records. Okay what does that mean? Simple, I have a set of pre-defined records that I read in every month from a handheld meter reader. During the import phase I run a series of checks against the data and anything that falls outside the acceptable parameters is annotated in my text box (txtErrors).

So here is an example of what errors would be in the text box:

WARNING!!! The following meters are missing from the Sensus Export file! Please investigate and correct prior to processing route# 4.

Route Seq# 004of135 / Meter ID W05001
Route Seq# 118of135 / Meter ID W82201

Potential read errors.
015of135 : this reading is possibly in error.0.48%.
018of135 : this reading is possibly in error.0.74%.
048of135 : this reading is less than the previous read!
053of135 : this reading is less than the previous read!
056of135 : this reading is possibly in error.0.35%.
133of135 : this reading is less than the previous read!

Pretty cut and dry what is dumped into txtErrors. But what I want to do, and have no idea how to do it... yet, is to be able to click on an element say "018of135 : this reading is possibly in error.0.74%." in the text box and go to that record. Now to explain how that would happen, the records are sorted so the first 3 digits match the actual record number (ex. Record 1 = 001of135, Record 2 = 002of135, etc...). Now I already know that in this example, if I go to record 18 I will actually see meter #19, why because meter #4 is missing from the table. Now I can take care of that easy enough.

What I don't know how to do, is click on a specific area within a text box then get that to trigger the event I want. Right now I click on the text box and I get everything. I don't really have any code for this yet, I am still experimenting with ideas. But I am running out of solutions that I have figured out on my own and so far none have worked.

Thanks!

One by one the penguins return my sanity, as day by day Microsoft steals my sanity!

OpenSuSE 10.0 kicks fanny!
 
Hi there.
Because all of your text is in a text box, and not separate records, I don't think you can easily pick out a "row" or "record". However, if you manually select the text that includes the recordID, you could then write code that's launched with a custom toolbar button that could do what you want. i.e.

You manually select "018of135"
Click a toolbar button that you make which runs a macro that calls code to:
COPY to clipboard
Paste into an invisible field (so you just have the "018of135" part segregated)
run code to open a record based on that data

I just did it quick mock-up of this and it works fine.

Ginger

Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244. Basics at
 
GingerR suggestion is a good one and might be the best. Let me offer a few other alternatives for thought
The first and what I think is the most flexible would be to ammend your code that "is annotated in my text box (txtErrors)" and make it place the text errors into a list box or a table. Then you can work with each line easier. If that is not possible I would look at the seltext, selstart and sellength propertys of the textbox. That coupled with instr you could perhaps write a fairly slick function that woulds search through you texterrors
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top