テキストフィールドを更新しようとしています。データを別の列に移動し、長すぎるため切り捨てます。
更新ステートメントは次のようになります。(編集済み)
UPDATE Feuil1 SET [Occupant 2] = SWITCH
(
[Occupant 2] IS NOT NULL, [Occupant 3],
(LEN([Occupant 1]) - LEN(REPLACE([Occupant 1], ' ', '')) = 3), mid([Occupant 1],InStr(InStr(1,[Occupant 1]," ")+1,[Occupant 1]," "),30),
(LEN([Occupant 1]) - LEN(REPLACE([Occupant 1], ' ', '')) = 4), mid([Occupant 1],InStr(InStr(1,[Occupant 1]," ")+1,[Occupant 1]," "),30),
(LEN([Occupant 1]) - LEN(REPLACE([Occupant 1], ' ', '')) = 5), mid([Occupant 1],InStr(InStr(1,[Occupant 1]," ")+1,[Occupant 1]," "),30),
(LEN([Occupant 1]) - LEN(REPLACE([Occupant 1], ' ', '')) = 6), mid([Occupant 1],InStr(InStr(1,[Occupant 1]," ")+1,[Occupant 1]," "),30),
(LEN([Occupant 1]) - LEN(REPLACE([Occupant 1], ' ', '')) = 7), mid([Occupant 1],InStr(InStr(1,[Occupant 1]," ")+1,[Occupant 1]," "),30),
(LEN([Occupant 1]) - LEN(REPLACE([Occupant 1], ' ', '')) = 2), '',
(LEN([Occupant 1]) - LEN(REPLACE([Occupant 1], ' ', '')) = 1), '',
[Occupant 1] LIKE '* & *', mid([Occupant 1],InStr(InStr(1,[Occupant 1]," ")+1,[Occupant 1]," "),30),
[Occupant 1] LIKE '* ET *', mid([Occupant 1],InStr(InStr(1,[Occupant 1]," ")+1,[Occupant 1]," "),30),
(LEN([Occupant 1]) - LEN(REPLACE([Occupant 1], ' ', '')) = 0), ''
), [Occupant 1] = SWITCH
(
(LEN([Occupant 1]) - LEN(REPLACE([Occupant 1], ' ', '')) = 3), mid([Occupant 1],1,InStr(InStr(1,[Occupant 1]," ")+1,[Occupant 1]," ")),
(LEN([Occupant 1]) - LEN(REPLACE([Occupant 1], ' ', '')) = 4), mid([Occupant 1],1,InStr(InStr(1,[Occupant 1]," ")+1,[Occupant 1]," ")),
[Occupant 1] LIKE '* & *', (replace([Occupant 1], ' & ' & mid([Occupant 1],InStr(InStr(1,[Occupant 1]," ")+1,[Occupant 1]," ")),InStr(InStr(2,[Occupant 1]," ")), '')),
[Occupant 1] LIKE '* ET *', (replace([Occupant 1], ' & ' & mid([Occupant 1],InStr(InStr(1,[Occupant 1]," ")+1,[Occupant 1]," ")),InStr(InStr(2,[Occupant 1]," ")), ''))
)
WHERE [Occupant 1] IS NOT NULL
変換タイプのエラーが常に発生しますが、理由がわかりません。独自の変更されたデータでテキスト フィールドを更新しています。関連する列はすべてテキストです。
Val()、Cstr() 関数を使用しようとしましたが、同じ結果が得られました。
追加情報: 一部のデータが処理されているようですが、理由がわかりません。
手がかりはありますか?