Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Import A Tab Delimited Text File Into A Sql Database


I have a log file which seperates the data by tabs. my question is, how do i import this text file into a sql databased that i've setup, using asp or a script?
thanks,
- gabe




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Import A Delimited Text File Into A Database
Hi all,

I am using the code below to Import a delimited text file into a database.By using that code I can import the same text file in the database.If the text file contains is already in the database stop the importation into the database.Can anyone help me in order to allow only one entry of a text in the database if the contains of the text file is already in the database

'Here is the code:


Code:
Option Explicit

Private Sub cmdImport_Click()
Dim delimiter As String
Dim wks As Workspace
Dim db As Database
Dim fnum As Integer
Dim text_line As String
Dim sql_statement As String
Dim pos As Integer
Dim num_records As Long

delimiter = cboDelimiter.Text
If Len(delimiter) = 0 Then
MsgBox "Please select a delimiter"
Exit Sub
End If

If delimiter = "<space>" Then delimiter = " "
If delimiter = "<tab>" Then delimiter = vbTab

' Open the text file.
fnum = FreeFile
On Error GoTo NoTextFile
Open txtTextFile.Text For Input As fnum

' Open the database.
On Error GoTo NoDatabase
Set wks = DBEngine.Workspaces(0)
Set db = wks.OpenDatabase(txtDatabaseFile.Text)
On Error GoTo 0

' Read the file and create records.
Do While Not EOF(fnum)
' Read a text line.
Line Input #fnum, text_line
If Len(text_line) > 0 Then
' Build an INSERT statement.
sql_statement = "INSERT INTO " & _
txtTable.Text & " VALUES ("
Do While Len(text_line) > 0
pos = InStr(text_line, delimiter)
If pos = 0 Then
' Add the rest of the line.
sql_statement = sql_statement & _
"'" & text_line & "', "
text_line = ""
Else
' Add the next field.
sql_statement = sql_statement & _
"'" & Left$(text_line, pos - 1) & _
"', "
text_line = Mid$(text_line, pos + Len(delimiter))
End If
Loop

' Remove the last comma.
sql_statement = Left$(sql_statement, Len(sql_statement) - 2) & ")"

' Insert the record.
On Error GoTo SQLError
db.Execute sql_statement
On Error GoTo 0
num_records = num_records + 1
End If
Loop

' Close the file and database.
Close fnum
db.Close
wks.Close
MsgBox "Inserted " & Format$(num_records) & " records"
Exit Sub

NoTextFile:
MsgBox "Error opening text file."
Exit Sub

NoDatabase:
MsgBox "Error opening database."
Close fnum
Exit Sub

SQLError:
MsgBox "Error executing SQL statement '" & _
sql_statement & "'"
Close fnum
db.Close
wks.Close
Exit Sub
End Sub
Private Sub Form_Load()
' Enter default file and database names.
txtTextFile.Text = App.Path & " estdata.txt"
txtDatabaseFile.Text = App.Path & " estdata.mdb"
End Sub

Text Delimited File Import
Ok, New Problem.

I am currently tryign to convert my access 97 Applications into "real" Applications using Visual Basic 6.0.

The Problem I am having is:

In Access we import a text delimited File in.
Inside of this file there may be 70 - 150 rows. Within Each row there is 34 fields that I need to import in to fields into a table.

So How could I do this in VB?

thanks

Import Delimited Text File To Access DB
Hi All,

Need a help for importing delimited text file into access database.

Thanks in advance.
Please Guide me in simple way.

Regards

Guru

VB.Net, Import Delimited Text File Into Access Table
I have developed a program in Access 2003 VBA that imports a delimited text file of 15 MB into Access2003 Table by using the Access.DoCmd acImport ... etc. However, I'm now converting this program into VB.Net by using the program to import the text file into Access Table. Does anyone know the "best and fastest (in term of time)" to do the import? I prefer not to create a dataset and update the table. I believe that it will take a long time with a 15 MB file.

Any suggestions would be greatly appreciated.

Converting A Comma Delimited File To An Inline Text File For Import
I'm looking for a way to convert a text file like this:-

INVNO,DATE,AMOUNT
1,06/10/2002,100
2,07/10/2002,150
3,08/10/2002,215
4,09/10/2002,100
5,10/10/2002,654
6,11/10/2002,12

into something like this:-

INVNO
DATE
AMOUNT
#MCBG
1
06/10/2002
100
#MCBG
2
07/10/2002
150 etc

#MCBG is a separator in the package i am using.

I've only just started this and kind of know what I am doing but its going to take a lot of playing around so any help would be grateful.

Thanks
Richard

Need Help !! Urgent !! Read Tab Delimited Text File And Import To SQL Table
Hi All,

I have been trying to get a code to read a text with tab delimited and then write to a SQL table. I have a code that works if the file is comma delimited. I have search and search the net for examples. I have even tried open the text with excel and saving it back down as a csv file. But that didnt work as it change the data a little. Can someone please help me here.

The code below is the code I have for importing a comma delimited file.

Code:FilePath = "C:mytestimport"
Dim FileName As String
FileName = Dir("C:mytestimport*.csv", vbArchive)
If FileName <> "" Then
  
GetRecordSet ("delete tmpimport")
Dim rst As ADODB.Recordset, xrst As Recordset
Set xdbs = OpenDatabase("", False, False, "Text;Database=" & FilePath & ";")
Set xrst = xdbs.OpenRecordset(FileName)
Set rst = GetRecordSet("tmpimport")

Do While Not xrst.EOF
    rst.AddNew
    For i = 0 To xrst.Fields.Count - 1
       On Error Resume Next
      rst.Fields(i) = xrst.Fields(i)
       On Error Resume Next
    Next i
    rst.Update
    xrst.MoveNext


Loop
End If

Set data1.Recordset = rst
DataGrid1.ReBind

Exit Sub

This project is for importing SalesOrders into a tmp Table to be later imported into differnt tables in the SQL database.

Clark



Edited by - clark on 7/8/2004 3:08:22 PM

Import Selected Rows From A Comma Delimited Text File Into Excel
I would like to import specific rows and specific values from a large comma delimited file.

For example, if the file was:

baseball, cardinals, st. louis, championship
football, rams, st. louis, championship
football, bears, chicago, championship
baseball, scrubs, chicago, loosers

I would like to import just the rows with "baseball" and only bring in the 2nd and 3rd "columns". File contains 25-30K rows. I want to bring these into a worksheet.

Connect Delimited Txt To Database (import/export)
I'm trying to make a vb executable that :
1. reads a delimited txt file
2. put the data in a table on a database (by connecting the table to the txt)
3. executing querys with sums
4. export the result to another delimited txt file.

So far I manage to do step 1 ... :-) ... I've the code but for some reason when I execute it, gives me error on locating the ISAM driver file for txt (I checked and it is on the WINNTSYSTEM32 where VB is looking.

Set dbsGICc = OpenDatabase("c: rabalho emporrio esteGICc.mdb")

Set tdfSAPAP = dbsGICc.CreateTableDef("SAPAP")

tdfSAPAP.SourceTableName = "c: rabalho emporrio esteA-SAPAP-20030630-1818.txt"
tdfSAPAP.Connect = "DATABASE=gicc;"

dbsGICc.TableDefs.Append tdfSAPAP <--- it errors because it doesn't find the ISAM.


I've the schema.ini file defined and in the same folder than all other files, should vb read this ? ... HELP

Make Database From Delimited Text File
Is there a routine out there that will take a delimited text file and import it into an access database?

Or do I just have to loop through and create it myself?

Saving MS Access Database To A Tab-Delimited Text File
I am trying to write my microsoft access database out into tab-delimited text file.

However the following code only writes to a unicode text file, by using ADODB.Stream. I wandered if anybody could help me, by stateing how can I write to a tab-delimited text file instead.


Set mstream = New ADODB.Stream
mstream.Open

'write header
mstream.WriteText "Event Id" + vbTab
mstream.WriteText "Day" + vbTab
mstream.WriteText "Time" + vbTab

'write each record in timetable
Do While Not rsTimetable.EOF

mstream.WriteText rsTimetable("Event ID") + vbTab
mstream.WriteText rsTimetable("Day") + vbTab
mstream.WriteText rsTimetable("Time") + vbCr

rsTimetable.MoveNext
Loop

rsTimetable.Close
mstream.SaveToFile Filename, adSaveCreateOverWrite
mstream.Close


Any help would be much apreciated

Many Thanks

Jimbo

Import Comma Delimited Text
I have a comma delimited text and have no problem importing to access except for one thing, there are text strings enclosed with " " that have commas within theme

example: "300000","Nice house near shopping, restaurants, etc","92504"

What do I have to add to the code so that the commas between the "" are ignored when I do an Ubound? I need a text definer


Thanks for any help

Kornel

Read Delimited Text File And Insert Into Access Database
i need to read a delimited text file and display it in access database
this is my text file:

Type Date Time Source Category Event User Computer
Success Audit 7/14/2004 10:04:30 AM Security Logon/Logoff 538 SYSTEM L340C53
Success Audit 7/14/2004 10:04:30 AM Security Logon/Logoff 538 SYSTEM L340C53
Success Audit 7/14/2004 10:01:44 AM Security Logon/Logoff 538 SYSTEM L340C53
Success Audit 7/14/2004 10:01:34 AM Security Logon/Logoff 540 SYSTEM L340C53

May i know how to code it in visual basic 6.0 to display in the database table?

Import Delimited File
hi all,

i want to import a delimited file into an access table thru my vb project. there is an option of TransferText with DoCmd. but that runs only when the user have access installed in his PC.

is there any other way thru which i can import a delimited file into my table. opening a text file and scaning thru it seems to be a lengthy process.

pls guide.

regards,

prakash

From Semicolon Delimited Text File To Microsoft Access Database Table
Hi,

I have a text file I receive daily with semicolons as delimiters. I was hoping to take certain data from this text file and shoot it into an Access database table (appending to existing data).

My goal is to create a table which historically tracks specific elements in this text file.

Any help or direction appreciated.

Convert More Than 255 Column Entries Of Database, Originally From Tab Delimited Text File
I was looking to convert the data in a tab delimited text file, which when expanded would run upto 295 columns in a ms-access database(two table in access) or two excel worksheets in msexcel. Since the data is tab delimited I am encountring few problems in deciphering the logic. I am using this piece of code for this entire process. CAN ANYBODY HELP ME WITH THIS....Please

PS: the line where variable k checks on numbers is to check the last field in each table defined in local array I find errors hitting when there is a zero-length character in the text field. str(k)="" looks for those.. also there are date datatype defined in the msaccess database there is type mismatch error occuring due to this zero length character as the tab count in the text file increases by 1 always!!

Code:Dim rs As New ADODB.Recordset
Dim tabb As Variant
Dim i As Integer
On Error Resume Next
tabb = Array("Universal_Form", "Employee_Data", "Spouse", "First_Dependent", "Second_Dependent", "Third_Dependent", "Fourth_Dependent", "Fifth_Dependent", "Life_Group", "Health_Questions", "Explanation_1", "Bankers_Life_Insurance")

    Set tx = fso.OpenTextFile(App.Path & "/S1UN003.txt", ForReading)
        While Not tx.AtEndOfStream
            Stop
            str = Split(tx.ReadLine, vbTab, , vbTextCompare)
            If UBound(str) < 295 Or UBound(str) > 295 Then Exit Sub
            j = 0
            i = 0
            For k = 0 To UBound(str)
                If Not k = 36 Or k = 39 Or k = 55 Or k = 71 Or k = 87 Or k = 119 _
                       Or k = 135 Or k = 181 Or k = 209 Or k = 227 Then
                    If tabOpen = False Then
                        rs.Open "SELECT * FROM " & tabb(j), con, 2, 3
                        If j = 2 Then Stop
                        rs.AddNew
                        If str(k) = "" Or IsNull(str(k)) Or str(k) = " " Then
                            If rs.Fields(i).Type = adDate Then
                                Stop
                            Else
                                rs.Fields(i) = Null
                            End If
                        Else
                            rs.Fields(i) = str(k)
                        End If
                        tabOpen = True
                    Else
                        If str(k) = "" Or IsNull(str(k)) Or str(k) = " " Then
                            If rs.Fields(i).Type = adDate Then
                                Stop
                            Else
                                rs.Fields(i) = Null
                            End If
                        Else
                            rs.Fields(i) = str(k)
                        End If
                    End If
                    i = i + 1
                    If k = 37 Or k = 40 Or k = 56 Or k = 72 Or k = 88 Or k = 104 Or k = 120 Or k = 136 Or k = 182 Or k = 210 Or k = 252 Or k = 295 Then
                        rs.Update
                        rs.Close
                        tabOpen = False
                        j = j + 1
                        i = 0
                    Else
                        rs.Update
                    End If
                End If
            Next k
        Wend
    Set tx = Nothing

To Import Tilde Delimited Text Files Into A Table
Hi

Can somebody help me out to import the Tilde Delimited text files into a table

Coding To Import Content Of Tab Delimited File Into Excel
Hey there guys!

I am trying to do this. When a user clicks on a button on an Excel spreadsheet, this will Import the file, e.g. "HelloWorld.txt" which is a Tab Delimited file into another Sheet Sheet(8) of the same spreadsheet. The thing is that in the text file, each Tab will indicate a new type of info...I'd like this to remain in Excel. This means that in Excel, each Tab field will fall into its separate columns.

Thank u so much for ur time n help, mates!

cheerz,
Adrian Quah

Import Text File Into .mdf Database?
Just wanted to know what the quickest way is to import data from a tab delimited text file into a database.
Through searching, I've seen references to creating a connection to a text file - similar to a connection to a database and going from there.

But is there a quicker way, rather than creating a connection to each text file to import it? Or is that the only way? If that is the only way, is someone able to provide me some sample code to work off?

How Do I Import Text File Into Database
hi everyone! just want to ask how do i import a text file into a database.
im using vb.net 2003 and firebird. and i have a sample data that looks like this:

(this is all in one line)

02,02,555 ,0,20080626,`F[02,02,,i05,05,Ki02,55555 ,1,,,0000000000002,X02,02,0, ,2,1,9999,20080626

can anyone help me on this problem?thanks very much in advance

Import Text File Into Sql Database
I am having difficulty importing a comma delimited text file into a sql database. This is very easy for me to do in access. I have tried the "transfer text" method and it wont work in sql only access. I have had success with the "bcp" method, however I need to be able to massage the text coming into the database and bcp wont allow me to do that.
Any help would be greatly appreciated.
Thanks,
Steve
Cruiserv2@mediaone.net

Import Text File Into Database
I am trying to import a text file into a database. Right now I am importing into an ADO recordset. Then trying to update the database by only useing the ADO recordset. I keep getting an error when I try it. Can anyone give me a better solution that will work?
The text file can be huge and I don't want the import to be really expensive on time. So I do not want to pull in, parse and then send out(takes to much time). Please help.
Thanks in advance

Import Text File In Access Database.
Hello everyone! I need some help regarding the import of some information from a text file in an access database. The text file contains 3 colums, for example
A 1 1A
B 2 2B
and so on.
How do I import this information in an access database, in a table which has 3 fields. The first column in the first field, the second column in the second field and the third column in the third field.
I know how to import all 3 columns in one field. I do not know how to tell the program to insert the first column in the firs field and so on.
Thank you very much. I realy need this.

[vb6]import Text File To SQL2005 Database Using Vb
hi guys can somebody help me i want to import my text file to an SQL2005 table. when i execute the following code i don't get an error but the data does not appear in the database

Code:
Open App.Path & "DataFilesGARA_C.TXT" For Input As #1
ConnectToDatabase
Set DataConn = Nothing
Do While Not EOF(1)
Line Input #1, FileLineString
If IsNumeric(Mid(FileLineString, 1, 6)) = True Then
ResetValues
BaseNumber = Mid(FileLineString, 1, 6)
CustomerName1 = Replace(Mid(FileLineString, 9, 36), "'", "''")
AccNo = Mid(FileLineString, 45, 12)
Ref = Replace(Mid(FileLineString, 58, 33), "'", "''")
AO = Mid(FileLineString, 91, 2)
Street = Replace(Mid(FileLineString, 94, 36), "'", "''")
City = Replace(Mid(FileLineString, 130, 21), "'", "''")
TelephoneNo1 = Replace(Mid(FileLineString, 151, 16), "'", "''")
TelephoneNo2 = Replace(Mid(FileLineString, 167, 16), "'", "''")
TelephoneNo3 = Replace(Mid(FileLineString, 183, 16), "'", "''")
ConnectToDatabase
Set RsRecords = New ADODB.Recordset
RsRecords.Open ("SELECT ACCOUNTNUMBER,NEW_BASENUMBER FROM GARAKWAZVO INNER JOIN GARAIVO ON GARAKWAZVO.ACCOUNTID=GARAIVO.ACCOUNTID WHERE GARAIVO.NEW_BASENUMBER='" & BaseNumber & "'"), DataConn, adOpenKeyset, adLockOptimistic
If RsRecords.BOF = False And RsRecords.EOF = False Then
DataConn.Execute ("INSERT INTO GARAKWAZVO (AccountId,DeletionStateCode,OwningBusinessUnit,OwningUser,[Name],AccountNumber,Telephone3,CreatedOn,CreatedBy,ModifiedOn,ModifiedBy,StateCode,StatusCode,ParentAccountId,TELEPHONE1,TELEPHONE2) (SELECT TOP 1 NEWID() AS AccountId,0 AS DeletionStateCode,OwningBusinessUnit ,OwningUser ,'" & Replace(CustomerName1, "'", "''") & "' AS [NAME],'" & Replace(AccNo, "'", "''") & "' AS ACCOUNTNUMBER,'" & Replace(TelephoneNo3, "'", "''") & "' as Telephone3,'" & Format(Date, "DD-MMM-YYYY") & "' as CreatedOn,CreatedBy ,'" & Format(Date, "DD-MMM-YYYY") & "' as ModifiedOn,ModifiedBy ,0 as StateCode,1 as StatusCode,AccountId as ParentAccountId,'" & TelephoneNo1 & "' AS TELEPHONE1,'" & TelephoneNo2 & "' AS TELEPHONE2 FROM GARAKWAZVO WHERE SUBSTRING(ACCOUNTNUMBER,3,6)='" & BaseNumber & "' AND ParentAccountId IS NULL)")
Set RsRecords = Nothing
Set DataConn = Nothing
DoEvents
Label1.Caption = CustomerName1
Else
End
End if
End If

Loop
MsgBox ("Finished Importing"), vbInformation
Label1.Caption = "Finished"
End Sub

Import Text File With Urls Into A Database
I have a text file that has a list of several hundred urls in it=2 I want to be able to import the list into a table in an acces database. I know how to import a comma delimited file into table, is it do the same way but using the '/' character as th delimiter? eg

http://office.microsoft.com/en-gb/default/defau lt.htm
http://office.microsoft.com/en-gb/default/index .htm
http://office.microsoft.com/ie-gb/index/hello=2 Ehtm

there are always the same amount of sub folders in the url (mayb as many as 10-15 depending on the file).

Below is the code i'm using to import a csv/txt file. Can I edi this so that it recognises the '/' character as the delimiter

Private Sub ImportTable1Text()

Dim strPath As String
strPath = CommonDialog1.FileName

On Error GoTo errHandler
Dim adoCN As ADODB.Connection
Dim adoRec As ADODB.Recordset
Dim ConnectString As String
Set adoCN = New ADODB.Connection
Set adoRec = New ADODB.Recordset
ConnectString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=D:\Visual Basic ProjectsFil ImportFileImport.mdb;"
adoCN.Open ConnectString
adoRec.Open "Table1", adoCN, adOpenDynamic, adLockOptimistic adCmdTable

'read the text file into the database ----------------------

Dim arrData() As String
Dim s As String
Dim i As Integer
Open strPath For Input As #1
lblCount = 0

'for every record add 1 to the count ---------------------

Do While Not EOF(1)
lblCount = Val(lblCount) + 1
DoEvents

'remove quotes from around text

Import Text File Into Access Database But Need To Trim Away Header
I need to read from a fixed length text file (file is output from another system's report with header) and store all the data in Access Database. The program requires to trim away all the header and read in only the data. Attach is a sample copy of the text file.

I'm using VB6.0, how do I code this action? Please help.

SC



Edited by - Steven Chan on 9/4/2003 9:05:17 AM

Delimited(;) Text Database &amp; Asp
Hi,

I have a problem in my ASP page. It's regarding my textfile database.

Here is some code snippet:

Code:

Dim strConn, conADO, rstCoupon, strSQL

strConn ="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strRoot & ";Extended Properties=""text;HDR=Yes;FMT=Delimited;"""

Set conADO = Server.CreateObject("ADODB.Connection")
Set rstCoupon = Server.CreateObject("ADODB.Recordset")

strSQL = "SELECT * FROM 200601.txt"

conADO.Open strConn

rstCoupon.CursorLocation = adUseClient
rstCoupon.Open strSQL, conADO, adOpenForwardOnly, adLockReadOnly, adCmdText    

'Until here its ok ! Everything works.
'rstCoupon.RecordCount = 6 --> THAT'S WRONG ... I HAVE 7 LINES IN MY 200601.TXT FILE (SEE BELOW)

'But here it's getting wrong !!

Response.Write rstCoupon.Fields(0).Value ' This line work
Response.Write rstCoupon.Fields(1).Value ' This give me an error:

'Error:
'ADODB.Recordset error '800a0cc1'
'Item cannot be found in the collection corresponding to the requested name or ordinal.



Why is that happening?

This is the content of my 200601.txt file
Code:
"000009";"336802";"20050527";17;"20060331"    
"000009";"336804";"20050527";34;"20060331"    
"000010";"139251";"20050301";11;"20060331"    
"000010";"139339";"20050301";12;"20060331"    
"000010";"139340";"20050301";13;"20060331"    
"000010";"139342";"20050301";11;"20060331"    
"000010";"139343";"20050301";10;"20060331"


This is the content of the schema.ini file
Code:
[200601.txt]
ColNameHeader=False
Format=Delimited(;)
MaxScanRows=1
Col1=F1 Char Width 6
Col2=F2 Char Width 6
Col3=F3 Char Width 8
Col4=F4 Float
Col5=F5 Char Width 8


Why is the recordcount incorrect ?
Why can I get the first column in my database when there is 5 columns?

If I try in my SQL Statement to ORDER BY F2. It doesn't work, the ASP script becomes in error when I open the recordset. It doesn't know F2. Why ?

Thanks a lot for helping.




Edited by - dbelley_office on 9/6/2006 2:03:27 PM

Comma Delimited Text Database Error...
I made an address book that saves everything as a text db, compiled it without error, and it keeps poping up an error message every time I hit the next button.

ERROR MESSAGE: "Updating data in a linked table is not supported by this ISAM."

What the @#$% does that mean?

Import Txt File Delimited &";&"
I want to import (via VBA code) in sheet_1 the records of this file from line:


;01005.8;00000000000;001;ENTE CREDITIZIO;1936-12-31;1936-12-31;0001-01-01; ;;0001-01-01;BANCA NAZIONALE DEL LAVORO;002;ISTIT. CRED. DIRITTO PUBBL.;000;;;00000;343000;VIA VITTORIO VENETO, 119;00187;343000;000000;1936-12-31;1960-12-30

and when code find OPERAZIONI import the rest of records in sheet_2 (operazioni is thi init of new stok of records it to the bottom of txt file)

In effect in the same file are 2 blobk of definition record:
first block init with DATI FILE and second block init with OPERAZIONI

note admit have the file in c:






Edited by - luca91 on 12/4/2007 1:15:18 PM

To Upload A Delimited File In Access Database
hi
I have an file which goes some thing like this
"BRK_HIGH 2' 8 7/16"  Price-  349.00  SCREEN  Bronze Manufacturer Client Name  GALIGN  No
ListPrice-  349.00 PrePrice-  349.00  INT_FIN  Interior Prime  MarkType  Mark  Label  0001  ParentPrePrice-nontaxable  0.00  SCRATCH  Yes PrePriceAdj  349.00  PC_HIGH  26  TotalListPrice  349.00  TotalPrePrice-nontaxable  0.00  IPrice-nontaxable  0.00 ProjectCount  AREA  5.777778 ProductCode  3226-1  xpos
@
ProjectActive  GRLCOLOR  White PricingCode  3226  DIR  L  PKBuild
TotalPrice  349.00  IPrice  349.00  FLAG30  True  SETUP  Basic  PrePrice  349.00  ProjectTaxStatus  GRILLE Rectangular  ID #  0001  GRLTYPE  3/4" Profiled Inner Grille ProjectTypes  PC_WIDE  32  ProjectOAmounts  Items   Base Price: 3226-1 Aluminum Mesh Screen Charge Bronze Tint IG Tempered. White 3/4" Profiled Inner Grille Standard 3W2H Bronze Hardware Upcharge Interior Prime Charge

and this is just a part of the whole file , can some one tell me whats with the boxes and how do i get rid of it. I tried to get an ascii value , but looks like every other box has a diff value. can anyone pls help.

himangi.

Writing A Comma Delimited File From MS SQL Database
I need to perform a select against a Microsoft Sql table and write the recordset to a flat file delimited by commas. Does anyone know how to do this?

Import Tab Delimited Txt Into ListBox
I have a tab delimited txt file that I call into a listbox, however its difficult to view (columns not aligned). I was wondering if I could state in my code that the text is tab delimited, to get it to line up properly with the column headers. Is this possible? My code so far is:


Code:
Private Sub CommandButton1_Click()

Dim textfile As String

Open "C:MyTextFile.txt" For Input As #1
Do While Not EOF(1)
Input #1, textfile
ListBox1.AddItem (textfile)
Loop
Close #1

I use the list box to delete rows from the text file and then save it back out as text - this bit works fine.

Import Tab Delimited Txt Into List Box
I have a list box which is populated by a tab delimited text file - this is fine.
Is there any way I can get my data to line up correctly? my code at the moment for importing is:


Code:
Private Sub CommandButton1_Click()

Dim textfile As String

Open "C:file.txt" For Input As #1
Do While Not EOF(1)
Input #1, textfile
ListBox1.AddItem (textfile)
Loop
Close #1
CommandButton1.Enabled = False

End Sub

Is it my problem that I am importing it in as a string? Basically I am trying to get my data to line up - I would prefer columns, but when I try to set this up, all my data crams into the first column - is there anyway I can tell it on import that it is tab delimited, and then tell the column properties the same so they line up?

Thanks in advance to anyone who has the answer!

Create Comma-delimited File Using Access Database
I know how to use ADO to work with Access Databases, but I need to create a comma-delimited file using the information in the recordset and I am not too sure how to do that.

I am aware of the for Output command for sequential files, but it requires Write# var1,var2,var3...

Is that the best way if you have several fields in the recordset?

Thanks

mc

Tab Delimited Text File
Hi,

I am not sure what is happening here. I need to create a tab delimited text file and here is what I am doing:

Dim strTextLine As String

'open file.
Open "test.txt" For Output As #1

strTextLine = "!TRNS" & Chr(9) & "TRNSID" & & Chr(9) & "TRNSTYPE"
Write #1, strTextLine

'close file.
Close #1


When I open this in Excel, the tabs were not set. All the text is in the first cell and the tabs are seen as "squares" within the text.

What am I doing wrong here?

Thanks.

Delimited Text File
I am creating a tab delimited text file and inserting the following line:

Dim TransmitID As String

TransmitID = "000002"

Print #3, TransmitID; Chr(9); " "; Chr(9); Date; Chr(9); Date

This is fine but when I import this text file into excel it removes the leading zeros of the TransmitID. Anyone any ideas?

Also I have another line:

Print #3, rstMyTable!ck_tot; Chr(9); rstMyTable!Error

The field ck_tot is a Numeric field with 2 decimal places, but when it is imported into excel it is just a whole number.


Anyone any ideas?

Delimited Text File
Hi Everyone,

I'm trying to convert a Delimited text File to Excel. The text file uses the "|" (pipe) character as the delimiter.

What I need to know is how to detect whether a text file is delimited or not ?

I would really appreciate it, If someone could illustrate an answer with some code.

Thanks..

Delimited Text File To Dbf
How can I import a delimited text file and export to a dbase file through VB.
Thanks!

Tab Delimited Text File
I am creating a tab delimited text file and inserting the following line:

Dim TransmitID As String

TransmitID = "000002"

Print #3, TransmitID; Chr(9); " "; Chr(9); Date; Chr(9); Date

This is fine but when I import this text file into excel it removes the leading zeros of the TransmitID. I know excel does not recognise it as a string but I need to have the leading zeros.

Also I have another line:

Print #3, rstMyTable!ck_tot; Chr(9); rstMyTable!Error

The field ck_tot is a Numeric field with 2 decimal places, but when it is imported into excel it is just a whole number.


Anyone any ideas?

Delimited Text File
Hey! is anybody out there know how to open a delimited text file by using the ADO object?

Thanks,
Chris.C

Tab Delimited Text File
I have several text files in different formats from which I need to pull specific data out of and export that data into an Excel spreadsheet. Please HELP! I have attached a sample of one of the text files.

Comma Delimited Text File
Hi All

I am trying to read a comma delimited text file from vb6, and have no idea where to start, if anyone could point me in the right direction i would really appreciate it. Ultimatly i would need to strip away all the commas then write the data into an access db. I'm not asking for code justb any advise or tutorials on how to get dtarted.

Many thanks in advance

Reading A Tab Delimited Text File
Hi,

How can I read & get the data in to 2D array from a tab delimited text file?

Thanks,
Chamila

Help Parsing A Non-delimited Text File
I have a text file that I need to export into excel or a comma delimited file. The file consists of a solid string of prices consisting of numbers and decimal points. The only way I can think to break it down is by finding the decimal point in the string advancing 2 digits for the cents(the price is not a fixed length throughout the file) parse it and keep repeating. Also the information represents columnar data,(i.e. there are 7 fields so after each 7th price a new line should be started to build the columns required. I'm sure this is quite simple but I've been away from programming too long for it to click. Any help is appreciated!

Parsing A Delimited Text File
I am trying to capture specific parts of a text file that is delimited with the "|" symbol and in lines that begins with "FT1".
ie. FT1 |A|B|C|This part is captured|D|E|F
The information will be in that segment every time but the number of lines there are will vary.

Any ideas?

Tab Delimited Text File And Arrays
I've seen many threads that talk about tab delimited text files, but none tells me what I need to know.

I have a tab-delimited text file that holds a person's name,email address, and phone number
I need that inputed into a multi-dimension array.
Example:

VB Code:
name(0,0)="Mine"name(0,1)="example@example.com"name(0,3)="555-1212"

what would be the easiest way to do this?

Creating A Text Delimited File
I just took a visual basic course and I am writing very simple visual basic programs. One of the programs that I am writing creates a text delimited file. The problem the text is being created delimited by commas. I needed it to be delimited by spaces for example I need

"Mortgage" "234" instead of
"Mortgage","234"

How do I instruct visual basic to delimit my file with spaces instead of commas?? Thanks for your help

Help Reading In Delimited Text File?
Hi all,

I have a text file that is delimited with a pipe | . What i want to do is read in the pipe separedt values into either a dbgrid or a listview control.
ANy ideas how i can accomplish this?

Thanks for any help!
later
b

Need Some Help Parsing A Delimited Text File
I need some help getting my program to open a delimited text file and placing the information in the correct text boxes.

i have the following in the txt files
charles
Intro to Win2k adv servBasic Admin course 3 days
Intro to ISA ServerBasic ISA server Install and config course

is used to seperate users records
then comes the course on a new line
and the seperates the course from its description

i can get it to open the entire file for editing which is useless, i need to be able to send each peice, seperated by user to a different box, ie lists the users in a text box and when you click on a user it would update the crstxtbox and update the course and description. which need to be editable seperatly but saved together.

I also have two other small things.

I need to add in a new field for each record which is a small picture which is stored in a seperate directory. and when you open the record it open the image in a picture box, and if it doesn't have a picture listed in the record it leaves it blank or loads a default picture.

and since many of these courses are the same i need the 2nd text box seperated with a drop down in which you can select the course, but not be limited to selecting a known course and be able to enter a new course

I hope this makes some sense
If some of you nice guys out there could help me with this. Also if you post code for if you have a chance could you please also post comments in it to what each part does, otherwise I am just coping and pasteing, and I would like to learn wht I am putting in so I can do it on my own next time I have a question

thanks

KC

Space Delimited Text File
I am working on a subroutine to convert space-delimited files to semicolon-delimited files. Right now the file looks something like this:

Adam Smith 45 Cherry St. 789-0098
Susan Sarandon 123 123rd Avenue 555-5555
Walter Matthau 54 Hollywood Blvd. 123-4567

Right now I am using the code

Open CommonDialog1.Filename For Input as #File1
Line Input #File1, strText

Open CommonDialog2.Filename For Output as #File2
Print #File2, Texto

Obviously all this does is copy the file but unfortunately that is about the extent of my VB experience. I need a subroutine that will read the file, replace the white spaces between columns with a ";" and also return the column length (e.g. the number of spaces between the A of Adam Smith and the first number of his phone number).

any suggestions will be GREATLY appreciated!

Thanks,

Andrew

Copyright 2005-08 www.BigResource.com, All rights reserved