简体   繁体   English

在每行的第 4 个字符中添加一个值

[英]Add a value into the 4th character of every row

I'm not good with English but hope I can make my question clear.我的英语不好,但希望我能把我的问题说清楚。 I have a table with tons of rows, all written in the format 00000 (ex.: 000001, 00002 etc).我有一个包含大量行的表格,所有行都以 00000 格式编写(例如:000001、00002 等)。 I need to change all of them by adding a letter in a fixed point of the number (00A000, 00A001 etc), always the same letter, always in the same position. So, either i manage to change the format of the rows to a custom format number-number-letter-number-number-number (which i'm able to do in Excel, but i can't find a way in Access), or I create an update query to add the letter A in that spot.我需要通过在数字的固定点(00A000、00A001 等)中添加一个字母来更改所有这些,始终是相同的字母,始终在相同的 position 中。因此,要么我设法将行的格式更改为自定义格式数字-数字-字母-数字-数字-数字(我可以在 Excel 中执行此操作,但我无法在 Access 中找到方法),或者我创建更新查询以在该位置添加字母 A . Anyone can help?任何人都可以帮忙吗?

I tired to change the format as i said, but can't find a way to add custom format in access.我厌倦了像我说的那样更改格式,但找不到在访问中添加自定义格式的方法。 I've tried to use an update query to add the letter after the 3rd character from the RIGHT, but i'ìve written the query wrong我尝试使用更新查询在右侧第 3 个字符后添加字母,但我写错了查询

You show one value with 6 digits and other with 5 digits.您显示一个 6 位数字的值,另一个显示 5 位数字的值。 If that is correct, consider (x represents your field or string): Left(x,2) & "A" & Mid(x,3)如果这是正确的,请考虑(x 代表您的字段或字符串): Left(x,2) & "A" & Mid(x,3)

If that is a posting error and all values are same length of 5 digits, consider: Format(x, "00A000") .如果这是一个发布错误并且所有值都是 5 位数的相同长度,请考虑: Format(x, "00A000")

Could run an UPDATE action to change data in field but it is not necessary as this calculation can be done when needed in query or textbox.可以运行更新操作来更改字段中的数据,但这不是必需的,因为可以在需要时在查询或文本框中完成此计算。

Could change field to a number type instead of storing repetitious characters.可以将字段更改为数字类型,而不是存储重复字符。 Also, Format property could use: 00\A000 .此外,格式属性可以使用: 00\A000

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM