Split delimited entries into new rows in Access

前端 未结 3 1379
执笔经年
执笔经年 2021-01-20 10:02

So someone gave me a spreadsheet of orders, the unique value of each order is the PO, the person that gave me the spreadsheet is lazy and decided for orders with multiple PO

3条回答
  •  忘掉有多难
    2021-01-20 10:22

    If I had to do it I would

    • Import the raw data into a table named [TempTable].
    • Copy [TempTable] to a new table named [ActualTable] using the "Structure Only" option.

    Then, in a VBA routine I would

    • Open two DAO recordsets, rstIn for [TempTable] and rstOut for [ActualTable]
    • Loop through the rstIn recordset.
    • Use the VBA Split() function to split the [PO] values on "/" into an array.
    • For Each array item I would use rstOut.AddNew to write a record into [ActualTable]

提交回复
热议问题