Solved

Import a text file and look for key Words

Posted on 2006-06-09
2
151 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
ID: 16869114
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
ID: 16869147
Thanks for the quick response
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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 process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

910 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

21 Experts available now in Live!

Get 1:1 Help Now