Just what I needed. Great thanks
Main Topics
Browse All TopicsI have a system that imports a number of pipe delimited files into Access. The names of these can vary and I do not want the users to have to rename into a consistent naming structure to manage the import process. Due to a new file being introduced, I need to be able to pick out all files of a type based on the number of columns in the file (greater than or less than 40 is sufficient at this stage).
Is there any way to look at a file before it is imported and count the columns?
Kelvin
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership
by: flavoPosted on 2008-05-18 at 20:54:15ID: 21595126
How about a function like this?
t")
Public Function CheckColumns(sFile As String) As Long
Dim sTemp As String
Dim lFile As Long
Dim i As Long
Dim lCount As Long
lFile = FreeFile
Open sFile For Input As #lFile
Input #lFile, sTemp
Close #lFile
For i = 1 To Len(sTemp)
If Mid(sTemp, i, 1) = "|" Then
lCount = lCount + 1
End If
Next
CheckColumns = lCount
End Function
Used like
lColumns = CheckColumns("C:\myFile.tx
Dave