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 John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

importing a converted PDF to TXT file to Access

Status
Not open for further replies.

SimoK

Technical User
Jan 6, 2003
7
GB
Hello

I am trying to create a database from a PDF file, I have converted it to txt but it has not done this cleanly, which means I cannot use the normal text import or I cut columns.

Does anyone have any code where it looks for spaces and takes the characters to the next space to make the field??

Any help suggestions appreciated
 
SimoK,
What a fun little exercise. Here is a snippet that will break the non-space groups of characters into separate elements of a string array. then you can just unload the array elements into a CSV record, and load that.

Of course, all bets are off if you have varying numbers of character groups in different rows.....this depends on all fields having something in them.

Public Function UnString()
Dim strIn As String
Dim strOut(1 To 7) As String 'The number of fields you have
Dim intPtr As Integer

'strIn is sample data to see how this works
strIn = " abcd efg h ijk lmn opq rst "
strIn = Trim(strIn)

For intPtr = 1 To 6 'The number of fields minus 1
strOut(intPtr) = Left(strIn, (InStr(strIn, " ") - 1))
strIn = Trim(Right(strIn, Len(strIn) - (InStr(strIn, " ") - 1)))
Next

strOut(7) = strIn 'The last field

End Function


Good Luck,
Tranman
 
Thanks Tranman

Have got the critical data out.

Regards
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top