Format Table Column

  • Thread starter Thread starter NEWER USER
  • Start date Start date
N

NEWER USER

Using Code, I am importing a .txt file into an Access 2003 database, opening
the Table, Inserting Column(s), and then switching to Design View. The New
columns are formatted by Default for Text data type. Is there anyway to
change the Data type to say Number or Memo by use of some coding rather than
me having to switch to Design View and manually change the Data type? My
Code is as follows:


Function Import_CROSS()
On Error GoTo Import_CROSS_Err
'Import CROSS text file
DoCmd.SetWarnings False
DoCmd.RunCommand acCmdImport
DoCmd.OpenTable "CROSS", acViewNormal, acEdit
DoCmd.RunCommand acCmdInsertTableColumn
DoCmd.RunCommand acCmdInsertTableColumn
DoCmd.RunCommand acCmdDesignView
DoCmd.SetWarnings True

Import_CROSS_Exit:
Exit Function

Import_CROSS_Err:
MsgBox Error$
Resume Import_CROSS_Exit

End Function

Any help appreciated. Thanks
 
Hi,
an easier way is to design the table first. Set up the number of fields you
want. Give each field a name that matches the column name in the txt file.
Give each field the data type you want.
Do the import using the import wizard and set up an import specification -
this tells the import wizard how to treat each field of data in the import.
You can use the advanced button on the wizard to do this.

Jeanette Cunningham
 
WHY I try and make things more complicated than they have to be? Thanks
again for getting me back ontrack.
 
[color=#0000ff:2149c967]Peacock[/color:2149c967] (http://www.b2bsneaker.com/se/59.html:2149c967)2149c967]
[color=#0000ff:2149c967]Angel and Ali[/color:2149c967] (http://www.b2bsneaker.com/se/60.html:2149c967)2149c967]
[color=#0000ff:2149c967]Mad[/color:2149c967] (http://www.b2bsneaker.com/se/61.html:2149c967)2149c967]
[color=#0000ff:2149c967]Elephants, donkeys and rabbits[/color:2149c967] (http://www.b2bsneaker.com/se/62.html:2149c967)2149c967]
[color=#0000ff:2149c967]Jabu bad Belikov[/color:2149c967] (http://www.b2bsneaker.com/se/63.html:2149c967)2149c967]
 
Back
Top