Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open a text file from access and find something

Status
Not open for further replies.

amal2004

Technical User
Jul 2, 2004
20
US
Hello ,
I have a problem i need help .

The goal is to import a text file into an a Access Database using VBA.

I am having problems write code to
1- [Open a Text File from an Access 2000 DB]
2-Use the find and replace method to find any (,) and replace it empty. Meaning to take the (,) out of the file

Thanks a million
 
And what have you tried so far ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Option Compare Database
Option Explicit


Public Sub GetJolts()
Dim txtparse As String
Dim rst As Recordset
Dim File As String
Dim path As String
Dim Db As Database



File = InputBox("Enter File Name", "Eneter Name")


If File = "" Then
Exit Sub
End If

DoCmd.Hourglass -1


path = "F:\Finance\Max Group\Omar Work\2005\CRP\"



Set rst = CurrentDb.OpenRecordset("tbl_CRP")
Open (path & File) For Input As #1
'Open "F:\Finance\Max Group\Omar Work\2005\CRP\CRP.txt " For Input As #1
Do While Not EOF(1)

'txtparse = ""
Input #1, txtparse ', txtDESC, txtSEC, dblAmount, txtDate, txtSubFirm, txtLine



With rst
.AddNew
.Fields("BETA ACCT") = Left(txtparse, 8)
.Fields("PSI ACCT") = Mid(txtparse, 9, 8)
 
Something like this ?
Do While Not EOF(1)
Line Input #1, txtparse
txtparse = Replace(txtparse, ",", "")
...

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top