|
-
May 25th, 2001, 02:00 PM
#1
Thread Starter
Junior Member
reading from a text file
I have a text file that contains 6 records per line. Each field is separated by a "!". I need to be able to read each line (record), set a variable to each field, and then insert a new reocrd into a sql database using the variables.
I appreciate any help!
-
May 25th, 2001, 02:10 PM
#2
Lively Member
you can use instr() function to show you where each ! is.
Then you can use the mid function to select all the text
between the 2 instr() values.
Hope this helps.
-
Aug 29th, 2001, 08:54 AM
#3
New Member
I'm doing a similar thing to the above except my numbers are just separated by spaces. It's a list of Time and Latitude / Longitude for an earthquake program. I was wondering if anyone could give me a bit more detail on how to get the separate numbers into separate variables - like Latitude into the variable Lat etc.
-
Aug 29th, 2001, 09:43 AM
#4
Lively Member
Let's say your string is "59 137 2 18"
Try this...
dim sString as String
dim sNumber1 as String
dim sNumber2 as String
sString = "59 137 2 18"
sNumber1 = left$(sString, instr(sString," "))
sString = right$(sString,len(sString)-len(sNumber1)+1)
sNumber2 = Left$(sString,instr(sString," "))
etc, etc
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|