Solved

Import a text file and look for key Words

Posted on 2006-06-09
2
150 Views
Last Modified: 2010-04-30
Hi EE

I am importing a text file into vb, which I can do

What I want to do is to have a look at the line in the text file and either split of filter different words and was looking at the best way to do it.

The information in the text file is like

advertising this is a general advertising query
general this is a general query
general this is a general query2
website this is a website query

so when I import the text file to the database I want col1 to be advertising and col2 to be "this is a general advertising query", then the next line col1 would be general and col2 would be "this is a general query" and so on, what would be the best way to achieve this

Thanks in advance

Paul

0
Comment
Question by:Paulstott
2 Comments
 
LVL 43

Accepted Solution

by:
TimCottee earned 500 total points
Comment Utility
Hi Paulstott,

For each line you return you would need to do something like:

Dim lngPos as long
Dim Col1 As String
Dim Col2 As String
lngPos = Instr(MyLineFromFile," ")
Col1 = Left(MyLineFromFile,lngPos)
Col2 = Mid(MyLineFromFile,lngPos+1)

Tim Cottee
0
 
LVL 1

Author Comment

by:Paulstott
Comment Utility
Thanks for the quick response
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now