Solved Insert text and a field value using command button (1 Viewer)

kevnaff

Member
Local time
Today, 08:51
Joined
Mar 25, 2021
Messages
141
Hello All.

I am creating a command button to add a new record to another table. I am able to add text to the new record, and also values from the form to the table, however I want to add both text and a field's value.

On my form I have a field called [Date Sent]. Say for example it is today's date 31/05/2022.

On the click event of my command button I want to add a new record to the [Assignments] table, and in the [Comments] field of this table I want to show the following:

This item was sent on 31/05/2022

Instead at the moment I am seeing:

This item was sent on [Date Sent].

The code I am using is:

Code:
REC("Comments") = "This item was sent on" & "[Date Sent]"

Would anybody be able to advise on how to correctly display the date sent?

Thanks in advance.
 

Minty

AWF VIP
Local time
Today, 08:51
Joined
Jul 26, 2013
Messages
10,355
You need to concatenate the value, not the field name.

Code:
REC("Comments") = "This item was sent on " & [Date Sent]
 

kevnaff

Member
Local time
Today, 08:51
Joined
Mar 25, 2021
Messages
141
You need to concatenate the value, not the field name.

Code:
REC("Comments") = "This item was sent on " & [Date Sent]
Thanks Minty, that makes sense.
 

Users who are viewing this thread

Top Bottom