invalid syntax error

merlin777

Well-known Member
Joined
Aug 29, 2009
Messages
1,397
Office Version
  1. 2007
i'm trying to concatenate two fields in a query and i'm getting asyntax error. could someone put me straight please? i've tried the following...

name: firstname&lastname
name: firstname & lastname
name: [firstname]&[lastname]
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Code:
[COLOR=#333333]name: [firstname] & [lastname][/COLOR]
should work, though I would not recommend using reserved words like "name" for variable or calculated field names. Use something like "myName" or "FullName".

If you are still getting errors, let us know what the error is.
Be sure that "firstname" and "lastname" exist in the table used in your query, and if you have multiple tables, you need to specify which table they are coming from, i.e.
Code:
FullN[COLOR=#333333]ame: [Table1]![firstname] & [/COLOR][COLOR=#333333][Table1]![/COLOR][COLOR=#333333][lastname][/COLOR]
 
Upvote 0
exxxcellent! it was the missing tablenames. assumed the row underneath specified that...
 
Upvote 0

Forum statistics

Threads
1,213,524
Messages
6,114,117
Members
448,549
Latest member
brianhfield

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top