Importing certain text from a .txt file to open URL

gr8_big_geek

New member
Joined
Apr 11, 2010
Messages
2
Programming Experience
Beginner
Greetings Friends!

I am once again working on a project and have hit an absolute wall! Here is what I'm trying to do:

1. Create a Userform that has one textbox and one button.
2. Have the user enter text in the textbox and press enter.
3. Once enter is pressed have the form take the data they typed into the textbox and search a specific .txt file (beginning the search from bottom to top to find the most recent entry) until it finds a match.
4. Take the latitude and longitude to the right of the match and convert them to proper form. Right now my SQL provides live updates to the .txt file only the lat/lon come accross as |-112053440|33427640|, so I need to insert decimals in the correct places.
5. Either way, they type "c123" it will search until it matches that then take the latitude and longitude that is to the right of the match.
6. Convert the latitude/longitude into proper format because if it pulls the data as is it will appear as:

"http://maps.google.com/maps?q=33480260,-11174307"

which will return with an error, unless it has those decimals in there like this:

"http://maps.google.com/maps?q=+33.480260,-111.74307"

If I can get the information to be imported and converted into string format I need to open a new instance of IE and have it open to this webpage.

The text in the .txt document looks like this:

[Sat Apr 10 05:53:30 2010] |AVL1|C123|-112065870|33428710|0780|0780|064000|064000|||||46412000|0|2|1000|3|20||
[Sat Apr 10 05:53:31 2010] |AVL1|C123|-112065260|33428810|0800|0800|064000|064000|||||46414000|0|2|1000|3|20||
[Sat Apr 10 05:53:52 2010] |AVL1|C123|-112059120|33428540|1000|1000|064000|064000|||||46434000|0|2|1000|3|20||
[Sat Apr 10 05:54:11 2010] |AVL1|C123|-112053440|33427640|1020|1020|054000|054000|||||46454000|0|2|1000|3|20||

I've been trying to use the InStrRev() command but have been getting lost in the coding...

I have my SQL set up to update this text file and the file remains at the same location on the drive all the time. Now I just need to get the file searched and the data to go straight to the webpage when a search is conducted.

Any help you could provide on the VB coding for this would be wonderful!

Thank you in advance,

Matt~
 
First off, what have you got so far?

Secondly, out of curiosity why is a text file acting as the middle man between an application and a database? Is it not possible to access the database directly?
 
Thank you very much for posting! I'm very glad you have written and I'm thankful for these forums where we can be free to exchange information.

As far as why I am using this .txt document: I have to because the software program that uses the SQL to generate this document would consider accessing the information from the source a "violation" of the EULA (and void our warranty we have with them). So it's "hands off" to that idea. I am glad I located this cache file where it dumps all of its locations so I can piggy back off of the information without damaging the business relationship between the two organizations (the one I work for and our vendor).

One thing I found out while I was coding is that this .txt document can be opened at any time without interrupting the SQL "dump" into the file. As you click to open it let's you simply look at a "snap shot" of the .txt file (as a read only). I reached a wall with VB and realized that I was not skilled enough to produce the look-up/searching coding necessary to accomplish this so I reverted back to another code that I'm more familiar with.

I actually wrote a program that accomplishes what I'm trying to do here with VB using a program called Autoit. I am trying to become more familiar with Visual Basic so that I have a more diverse amount of programming experience/skill and so I'm here on this forum trying to learn. If you would like I can share with you my coding for the Autoit version I have. Who knows maybe you will enjoy Autoit as well?

As far as how much I've done; not very much at all. I have the GUI or Form made with the textbox and button but that is about it. I couldn't figure out how to get the button to do anything if/when it were pushed. I will continue to work on it as I can though.

Any assistance you could provide during my journey through this project with VB would be so wonderful.

Thank you in advance! I hope you have a wonderful day.

Your friend,

Matt~
 
Back
Top