truncate zero in the starting when importing from text file

  • Thread starter Thread starter Mohsin Habib
  • Start date Start date
M

Mohsin Habib

Hi,
I am importing data from text file, it has the field of telephone numbers,
but access truncate all the zeros in the starting. I have set the field type
as Text but still it is not working (although its work when I manually type
data in that field but does not work while importing). I need to display all
the zeros in the field to distinguish local and international calls. Please
help if someone knows the solution.
 
Mohsin said:
Hi,
I am importing data from text file, it has the field of telephone
numbers, but access truncate all the zeros in the starting. I have
set the field type as Text but still it is not working (although its
work when I manually type data in that field but does not work while
importing). I need to display all the zeros in the field to
distinguish local and international calls. Please help if someone
knows the solution.

When you import a text file an import specification is created. During that
process Access will examine the data on the first few lines and make assumptions
about the data type for each field. While in the import wizard you should have
a step where YOU can specify the data types on each field instead of allowing
the assumptions. You need to specify text on that field.
 
Actually I am importing the data in Access using VB 6.0, for this I have
first created table in Access and then write code in VB to import data in
it...

code is look like this
-----------------------------
strCn = "Driver={Microsoft Text Driver (*.txt; *.csv)} ;" & _
"DBQ=" & App.Path & ";" & _
"DefaultDir=" & App.Path & ";"

Set adoCn = New ADODB.Connection
adoCn.Open strCn

strSQL = "INSERT INTO [" & txtTable.Text & "] IN '" & App.Path & "\Table.mdb
'"
strSQL = strSQL & "SELECT * FROM " & txtFile.Text
adoCn.Execute strSQL
----------------------------

code is working but I am experiencing the probelm which I have mention in my
question...... So I cant check it during the process of importing as it is
automated....
Is there any solution for it??????
 
Actually I am importing the data in Access using VB 6.0, for this I have
first created table in Access and then write code in VB to import data

You seem to be using Jet, not Access, therefore use a schema.ini file
(google it) to define the data types.

Import specs = Access, not Jet
schema.ini file = Jet

Jamie.

--
 
Back
Top