Connecting Tech Pros Worldwide Help | Site Map

Inserting Spaces Between Fields in Expression Builder

  #1  
Old November 12th, 2005, 07:14 PM
Darren
Guest
 
Posts: n/a
Hi All,

This will probably have the easiest solution but as I'm still a newbie
and need some help...

When building a query I would like to create a field called Name which
includes both the first and last name of the person.

Here's the expression:

Name: [tblStaff]![FirstName]+[tblStaff]![LastName]

It works great except for the fact that the is no space between the
first and last name.

Ideas???

Thanks in advance,
Darren Stahlhut.
  #2  
Old November 12th, 2005, 07:15 PM
Helen Wheels
Guest
 
Posts: n/a

re: Inserting Spaces Between Fields in Expression Builder


Darren wrote:[color=blue]
> Hi All,
>
> This will probably have the easiest solution but as I'm still a newbie
> and need some help...
>
> When building a query I would like to create a field called Name which
> includes both the first and last name of the person.
>
> Here's the expression:
>
> Name: [tblStaff]![FirstName]+[tblStaff]![LastName]
>
> It works great except for the fact that the is no space between the
> first and last name.
>
> Ideas???
>
> Thanks in advance,
> Darren Stahlhut.[/color]



Hi Darren

You need to put in the space explicitly. Either of these should
work:

FullName: [tblStaff]![FirstName]+" "+[tblStaff]![LastName]
OR
FullName: [tblStaff]![FirstName]+chr(32)+[tblStaff]![LastName]

(32 being the ASCII code for the space character)
Note, it may be safer to call your calculated field something
like FullName as there is already a built-in Access property
called Name.

Cheers

  #3  
Old November 12th, 2005, 07:16 PM
Darren
Guest
 
Posts: n/a

re: Inserting Spaces Between Fields in Expression Builder


Helen Wheels <helenwheelss@yahoo.com.au> wrote in message news:<400B9AD3.2010704@yahoo.com.au>...[color=blue]
> Darren wrote:[color=green]
> > Hi All,
> >
> > This will probably have the easiest solution but as I'm still a newbie
> > and need some help...
> >
> > When building a query I would like to create a field called Name which
> > includes both the first and last name of the person.
> >
> > Here's the expression:
> >
> > Name: [tblStaff]![FirstName]+[tblStaff]![LastName]
> >
> > It works great except for the fact that the is no space between the
> > first and last name.
> >
> > Ideas???
> >
> > Thanks in advance,
> > Darren Stahlhut.[/color]
>
>
>
> Hi Darren
>
> You need to put in the space explicitly. Either of these should
> work:
>
> FullName: [tblStaff]![FirstName]+" "+[tblStaff]![LastName]
> OR
> FullName: [tblStaff]![FirstName]+chr(32)+[tblStaff]![LastName]
>
> (32 being the ASCII code for the space character)
> Note, it may be safer to call your calculated field something
> like FullName as there is already a built-in Access property
> called Name.
>
> Cheers[/color]

Hi Helen,

That is exactly what I needed :) Thanks

Darren Stahlhut
Closed Thread