访问VBA从文本框复制部分文本,类似于excel中的MID [复制]

时间:2022-11-19 22:02:13

This question already has an answer here:

这个问题在这里已有答案:

I have a text box that populates when searching for a members information. The text box populates with a claim # in the format of: A999999999999001 where the 9's could be any # but the letter A and the 001 will always be consistant.

我有一个文本框,在搜索成员信息时填充。文本框填写声明#,格式为:A999999999999001,其中9可以是任何#,但字母A和001将始终是一致的。

In excel you can use the formula =mid(cell reference, starting character, # of characters) to extract the middle portion of the text..

在excel中,您可以使用公式= mid(单元格引用,起始字符,字符数)来提取文本的中间部分。

is there a way to do this in Access? I want to create a "COPY" button that will allow users to copy just the 9's from the claim # to the clipboard and drop the A and 001's.

有没有办法在Access中执行此操作?我想创建一个“COPY”按钮,允许用户将声明#中的9个复制到剪贴板,然后删除A和001。

The claim # must maintain its full format in the tables, however the reduced portion is used in another program to pull up specific information about a transaction.

声明#必须在表中保持其完整格式,但是缩减部分在另一个程序中用于提取有关事务的特定信息。

Any help would be greatly appreciated.

任何帮助将不胜感激。

1 个解决方案

#1


0  

I am still unsure how to copy (if possible) directly to the clipboard from the text box.. Based on the techonthenet article posted (Thank you for that.. I did try to search Stack before posting my question.. hadn't found any definitive answers) I was able to complete the task by creating a 2nd text box that fills and then is copied from with the button press.. Code is this:

我仍然不确定如何从文本框直接复制(如果可能)到剪贴板..基于techonthenet文章发布(谢谢你...我在发布我的问题之前尝试搜索Stack ..没找到任何明确的答案)我能够通过创建第二个文本框来完成任务,然后通过按下按钮来复制该文本框。代码是这样的:

'Dim CopyArgusNum1 As String CopyArgusNum1 = Mid(Me.txtArgusClaim1.Value, 2,12) 
Me.txtCopyArgusClaim1.Value = CopyArgusNum1 
Me.txtCopyArgusClaim1.SetFocus 
DoCmd.RunCommand acCmdCopy'

#1


0  

I am still unsure how to copy (if possible) directly to the clipboard from the text box.. Based on the techonthenet article posted (Thank you for that.. I did try to search Stack before posting my question.. hadn't found any definitive answers) I was able to complete the task by creating a 2nd text box that fills and then is copied from with the button press.. Code is this:

我仍然不确定如何从文本框直接复制(如果可能)到剪贴板..基于techonthenet文章发布(谢谢你...我在发布我的问题之前尝试搜索Stack ..没找到任何明确的答案)我能够通过创建第二个文本框来完成任务,然后通过按下按钮来复制该文本框。代码是这样的:

'Dim CopyArgusNum1 As String CopyArgusNum1 = Mid(Me.txtArgusClaim1.Value, 2,12) 
Me.txtCopyArgusClaim1.Value = CopyArgusNum1 
Me.txtCopyArgusClaim1.SetFocus 
DoCmd.RunCommand acCmdCopy'