Note that there are some explanatory texts on larger screens.

plurals
  1. POConversion error on updating text field - MS Access
    text
    copied!<p>I am trying to update a text field. Moving data to another column and truncate because it is too long.</p> <p>The update statement looks like this. (Edited)</p> <pre><code>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 '* &amp; *', 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 '* &amp; *', (replace([Occupant 1], ' &amp; ' &amp; mid([Occupant 1],InStr(InStr(1,[Occupant 1]," ")+1,[Occupant 1]," ")),InStr(InStr(2,[Occupant 1]," ")), '')), [Occupant 1] LIKE '* ET *', (replace([Occupant 1], ' &amp; ' &amp; mid([Occupant 1],InStr(InStr(1,[Occupant 1]," ")+1,[Occupant 1]," ")),InStr(InStr(2,[Occupant 1]," ")), '')) ) WHERE [Occupant 1] IS NOT NULL </code></pre> <p>I always get conversion type error but I don't know why. I am updating a text field with it's own modified data. All the columns involved are text.</p> <p>I've tried to use Val(), Cstr() functions, same result.</p> <p>Additionnal informations: Some data seems to be processed, but I can't find why.</p> <p>Any clues?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload