ID | 分配给 | 工作订单编号 | close_wo_date | 结束日期 | 工作订单状态 | 邮政编码 | 订单类型 |
---|---|---|---|---|---|---|---|
611802 | 约翰、艾德、艾尔、德克斯特 | TMN-09/10/24-2113-0133 | 2024-10-10 15:24:00.000 | 2024-10-10 15:23:00.000 | 关闭 | 2113 | 特发性骨髓瘤 |
数据类型:自动编号、短文本、短文本、...
我想分离“assigned_to”列中的值。但是,我在第 16 行收到类型不匹配错误。
workOrderId = rstIn!work_order_id
我不知道问题是什么。
Option Compare Database
Sub TransformTable()
Dim dbs As DAO.Database
Dim rstIn As DAO.Recordset
Dim rstOut As DAO.Recordset
Dim arrParms() As String
Dim workOrderId() As String
Dim i As Long
Set dbs = CurrentDb
Set rstIn = dbs.OpenRecordset("teszt_in", dbOpenForwardOnly)
Set rstOut = dbs.OpenRecordset("teszt_out", dbOpenDynaset)
Do While Not rstIn.EOF
If Not IsNull(rstIn!assigned_to) Then
arrParms = Split(rstIn!assigned_to, ",")
workOrderId = rstIn!work_order_id
For i = 0 To UBound(arrParms)
rstOut.AddNew
rstOut!ID = rstIn!ID
rstOut!assigned_to = arrParms(i)
rstOut!work_order_id = workOrderId(i)
rstOut.Update
Next i
End If
rstIn.MoveNext
Loop
rstIn.Close
rstOut.Close
End Sub
workOrderId
不应该是一个数组,所以使用: