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

dbf to tab delimited proggy 1

Status
Not open for further replies.

trent101

Programmer
Nov 4, 2005
50
AU
Hey,

Does anyone know of a program that convert dbf files to tab delimeted files? preferably run from a command line?

I have a program that reads from tab delimieted files, however it now needs to read from this dbf file. If I open the file in excel and save it as a tab delimited file it works, but I would love a command line proggy that could do this so I could automate the whole thing.

Thanks for your time.
 

I notice that although you've asked over 30 questions, you haven't marked any of the answers as helpful, and haven't even acknowledged most of the answers. If the answers haven't been what you're looking for, then read faq222-2244 carefully to find out how to ask better questions, and get the best from these forums. If the answers have solved your problems, then read faq222-2244 to see how to acknowledge answers properly.

For this question, why not use Excel VBA to automate the process? You can simply record a macro to do what you want. If you need more help on Excel VBA, try forum707.

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
 
johnwm,

thanks for your reply. I never even knew that you were meant to mark posts as helpfull. I will read the faq and make sure I do this from now on. Thanks for the pointers.
 
Don't worry! There is no 'meant to'. Its entirely up to you to decide whether you find an answer valuable or not. I just wanted to see whether you were getting the right answers or not.

Its also helpful for other users of the site to see starred posts, as they then know that the answer helped somebody. As you keep using the forum, and start to answer a few questions for other people you will be very proud of your first star!

I'm glad this one helped you, and thanks for the star [smile]

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
 
I don't know of a program that does this specifically but writing something to do it should not be too difficult
Code:
Public Sub ExportToTab(dbfFile As String, TabFile As String)
Dim con                         As New ADODB.Connection
Dim rs                          As New ADODB.Recordset
Dim fld                         As ADODB.Field
Dim TabRec                      As String
Dim nH                          As Integer

nH = FreeFile
Open TabFile For Output As #nH

con.Open "Provider=Microsoft.Jet.OLEDB.4.0" & _
         ";Data Source=" & dbfFile & _
         ";Extended Properties=dBASE IV;"

rs.CursorLocation = adUseClient
rs.CursorType = adOpenKeyset
rs.Open File, con

Do Until rs.EOF
   TabRec = ""
   For Each fld in rs.Fields
      TabRec = TabRec & fld.Value & vbTab
   Next
   TabRec = Left(TabRec, Len(TabRec) - 1)
   Print #nH, TabRec
   rs.MoveNext
Loop

Close #nH
Set rs = Nothing
Set con = Nothing

End Sub
 
I have used access to open a DBF file. I am thinking Access has a way of exporting a comma delimited file because that is the access default for files I do believe. I could be wrong. Seems like it is a process of open and save as. I dont think MS Access allows you to open DBF files by default when you click on them, but I have viewed DBF Extracts in Access many times when we exported them from the mainframe VSAM Files using Decision Technology report generator.

If you do not like my post feel free to point out your opinion or my errors.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top