访问 VBA 以将注释附加到文本框(已编辑)
Access VBA to append comments to textbox (edited)
问题:如果我在 Access 表单上有一个文本框,文本框中已经有评论,我如何创建一个按钮来插入另一个要追加的评论而不删除当前评论?示例:带有第一条评论的文本框。 [单击按钮] 在第一条评论或下一行之后添加第二条评论。
[单击 Button1] 并发表第一条评论。
me.comment="first comment"
[单击按钮 2],其中有第二条评论要附加到第一条评论。
me.comment="with new second comment added without deleting first comment"
得到这样的东西...
first comment with new second comment added without deleting first comment
你想要做的是所谓的字符串连接,与&
(或+
)一起使用来组合两个字符串。
你是这个意思吗?
Me.comment = "first comment"
Me.comment = Me.comment & " " & "with new second comment added without deleting first comment"
& " "
在当前内容和附加内容之间添加一个空格。
但是如果你在要添加的字符串中添加空格,你也可以像这样使用它:
Me.comment = Me.comment & " with new second comment added without deleting first comment"
如果你想在中间添加一个新的行,你可以这样做:
Me.comment = Me.comment & vbNewLine & "with new second comment added without deleting first comment"
问题:如果我在 Access 表单上有一个文本框,文本框中已经有评论,我如何创建一个按钮来插入另一个要追加的评论而不删除当前评论?示例:带有第一条评论的文本框。 [单击按钮] 在第一条评论或下一行之后添加第二条评论。 [单击 Button1] 并发表第一条评论。
me.comment="first comment"
[单击按钮 2],其中有第二条评论要附加到第一条评论。
me.comment="with new second comment added without deleting first comment"
得到这样的东西...
first comment with new second comment added without deleting first comment
你想要做的是所谓的字符串连接,与&
(或+
)一起使用来组合两个字符串。
你是这个意思吗?
Me.comment = "first comment"
Me.comment = Me.comment & " " & "with new second comment added without deleting first comment"
& " "
在当前内容和附加内容之间添加一个空格。
但是如果你在要添加的字符串中添加空格,你也可以像这样使用它:
Me.comment = Me.comment & " with new second comment added without deleting first comment"
如果你想在中间添加一个新的行,你可以这样做:
Me.comment = Me.comment & vbNewLine & "with new second comment added without deleting first comment"