Home > Net >  String in Access Expression Builder giving error
String in Access Expression Builder giving error

Time:03-11

I'm attempting to concatenate the current year "2022" with two words (i.e. 2022 My Example) in the Expression Builder of Microsoft access.

I'm using the control source field with dynamically creating the year with a the set string phrase of "My Example"

=FormatDate(Date(),"yyyy")   [My Example]

I keep getting the error: "The expression you entered contains invalid syntax. Can anyone shed light on why this is happening?

CodePudding user response:

Try this! Change FormatDate to Format

=Format(Date(),"yyyy") & [My Example]

CodePudding user response:

I'm not sure what FormatDate() is unless this is a function you've written yourself. You may have meant to use simply Format(). Also you'll want to use quote characters " instead of brackets [] to concatenate a string:

=Format(Date(),"yyyy") "My Example"

  • Related