View Full Version : Importing text files into a table


Caroline001
06-06-2008, 04:07 AM
Hi there,
I am using Microsoft 2003 and Vista.
I am trying to import a Text file and create a table and the only formats I have available to me are:
Microsoft Office Access
Windows Sharepoint Services
XML
ODBC Databases

Is there a patch or a setting which will enable me to see the normal full list of file types?
:confused:

ThomasT
06-08-2008, 12:14 PM
hi, im noob but i find this:

http://www.databasedev.co.uk/text-import-macro.htmlI try i to automatize using this code
Function ImportTxt()
'Created by Helen Feddema 08-23-2001
'Last modified by Thomas 04-28-2008

If gblnErrorTrapping = True Then On Error GoTo ErrorHandler
On Error Resume Next

'Warning Off
DoCmd.SetWarnings False

'Delete old tbl (from previous import session)
DoCmd.DeleteObject ObjectType:=acTable, _
objectname:="tblImportRaw"

Dim strFilePath As String
Dim strFullDBName As String
Dim strDBName As String
Dim strFullPath() As String
Dim intUBound As Integer
Dim dbs As DAO.Database
Dim strFileName As String

'Returns path to database
Set dbs = CurrentDb
strFullDBName = dbs.Name
strFullPath = Split(strFullDBName, "\", -1, vbTextCompare)
intUBound = UBound(strFullPath)
strDBName = strFullPath(intUBound)
strFilePath = Mid(dbs.Name, 1, Len(dbs.Name) - Len(strDBName))
Debug.Print "Path: " & strFilePath
strFileName = strFilePath & "import.txt"

'Imports information from file import.txt, which lies in the same directory as db into tblimportRaw
DoCmd.TransferText transfertype:=acImportFixed, _
specificationname:="import_t", _
TableName:="tblImportRaw", FileName:=strFileName, _
hasfieldnames:=False

ErrorHandlerExit:




Exit Function

ErrorHandler:
MsgBox "Error No: " & Err.Number & "; Description: " & Err.Description
Resume ErrorHandlerExit

End FunctionYou have to specified "specification file" before run this code


http://support.microsoft.com/kb/208991
http://www.btabdevelopment.com/main/QuickTutorials/A2K7HowtoCreateanImportSpecification/tabid/99/Default.aspx
try to search http://www.helenfeddema.com/ for more.

gemma-the-husky
06-08-2008, 12:25 PM
reinstall access, selecting all the drivers etc

its in there somewhere

you should have text, csv, excel etc etc