importing data

Discussion in 'Access VBA Modules' started by geert.vanransbeeck@belfius.be, Jul 17, 2013.

  1. Guest

    It has been quiet a while (several years) since I did some programing in VBA. I was and still am a newbee in VBA.
    So would someone be so kind to help me with this one.

    Beneath I put some code which imports some csv data into an access table. For years it worked in Access 2003. But now we moved tot Access 2011 and data doesn't fit anymore in the appropriate field. I get a series of comma delimited data in 1 field, another comma delimited data into another etc.

    Some I suppose I have to ad some extra code in order to get rid of this andput every separate data into the right consecutive field.

    info: 'TBL_field_names' serves as to give each field in my table a new nameand changes the imported old name into a new fieldname.

    I hope I made myself understandable.

    Thanks
    Geert



    Private Sub Command81_Click()
    Dim rst_data As Recordset
    Dim oldname As String, newname As String
    DoCmd.DeleteObject acTable, "TBL_import_TPXP_Radi_Evvd"
    DoCmd.TransferText acImportDelim, , "TBL_import_TPXP_Radi_Evvd", "N:\APPLSHARE\PRD\QSIG\MKTDISTPWB\USPB1815\RADIEV\IMPACT.CSV", False, ""

    Set rst_data = CurrentDb.OpenRecordset("TBL_field_names")

    With rst_data
    ..MoveFirst
    Do Until .EOF
    oldname = .Fields(0).Value
    newname = .Fields(1).Value
    changefieldnames oldname, newname
    ..MoveNext
    Loop
    End With
    Set rst_data = Nothing

    'DoCmd.RunSQL "ALTER TABLE [TBL_import_TPXP_Radi_Evvd] ALTER COLUMN [Ontlener] text"
    'DoCmd.RunSQL "UPDATE TBL_import_TPXP_Radi_Evvd SET TBL_import_TPXP_Radi_Evvd.Ontlener = Right('000000000000' & [TBL_import_TPXP_Radi_Evvd]![Ontlener],12);"
     
    , Jul 17, 2013
    #1
    1. Advertisements

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Similar Threads
  1. a egbunike

    importing word data into an access database

    a egbunike, Jul 28, 2003, in forum: Access VBA Modules
    Replies:
    1
    Views:
    123
    Alick [MSFT]
    Jul 30, 2003
  2. Terri Pecora

    Advice: Importing data into Access Table

    Terri Pecora, Aug 20, 2003, in forum: Access VBA Modules
    Replies:
    0
    Views:
    117
    Terri Pecora
    Aug 20, 2003
  3. brian

    Importing Data

    brian, Aug 29, 2003, in forum: Access VBA Modules
    Replies:
    0
    Views:
    95
    brian
    Aug 29, 2003
  4. Frank

    Importing huge amounts of data, how to

    Frank, Oct 7, 2003, in forum: Access VBA Modules
    Replies:
    2
    Views:
    112
    Geoff
    Oct 7, 2003
  5. Lee T.

    Automate Importing Data via ODBC

    Lee T., Nov 24, 2003, in forum: Access VBA Modules
    Replies:
    1
    Views:
    148
    Guest
    Nov 24, 2003
  6. Don

    Importing Data into a memo field

    Don, Aug 7, 2004, in forum: Access VBA Modules
    Replies:
    1
    Views:
    159
    John Nurick
    Aug 7, 2004
  7. Chris
    Replies:
    1
    Views:
    97
    Tim Ferguson
    Oct 6, 2004
  8. JT

    importing data

    JT, Jul 14, 2005, in forum: Access VBA Modules
    Replies:
    2
    Views:
    70
    Brian
    Jul 14, 2005
Loading...