Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / General 2 / September 2007

Tip: Looking for answers? Try searching our database.

concatenate fields

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
accessuser1308 - 11 Sep 2007 13:46 GMT
I do not know if this can be done easily....

I have made a database for keeping track of the pictures I take.  I have a
field (memo) [people] where I enter any people that are present in the
picture (ex. Person1, Person2, etc).  Is there a way that I can put a single
combo box on the form (which will contain a list of all the people I may
photograph) such that when I select a name it will add it to the memo field
[people].  Then, if I select a second name from the combo box it will add a
comma, a space, and then the second name and so on for each name chosen.

I am completely stuck, so any help would be appreciated.
Thank you
Al Campagna - 11 Sep 2007 14:27 GMT
accessuser1308,
   Use the AfterUpdate event of the combo (ex. combo name = cboPeople and
memo name = memPeople).

memPeople = memPeople & ", " & cboPeople

   As each name is selected, it is concatenated onto whatever is in
memPeople (seperated by a comma).

Signature

hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html
"Find a job that you love... and you'll never work a day in your life."

>I do not know if this can be done easily....
>
[quoted text clipped - 11 lines]
> I am completely stuck, so any help would be appreciated.
> Thank you
accessuser1308 - 11 Sep 2007 14:48 GMT
Hi Al,

Thank you for your quick response.  The code you gave me does almost exactly
what I want it to do.  The first entry has a comma and a space before it
though.  Is there a way to have the first name added to the box and only
subsequent names to be separated by a comma and a space?

Thank you

> accessuser1308,
>     Use the AfterUpdate event of the combo (ex. combo name = cboPeople and
[quoted text clipped - 20 lines]
> > I am completely stuck, so any help would be appreciated.
> > Thank you
fredg - 11 Sep 2007 15:25 GMT
> Hi Al,
>
[quoted text clipped - 29 lines]
>>> I am completely stuck, so any help would be appreciated.
>>> Thank you

Test if the [MemPeople] is null.

If IsNull([MemPeople]) Then
    [MemPeople] = [cboPeople]
Else
    [memPeople] = [memPeople] & ", " & [cboPeople]
End If

However, this is not the correct method for doing something like this.

Have a separate table and enter each person's name as an individual
record in this table.

Table name:   tblInThePicture
Field Name     PictureID  Number datatype  Long field Size Duplicates
OK
Field Name     InPicture  Text datatype

The table is the recordsource for a sub-form of your current Picture
form, linked to the main form by the PictureID field.

Each person in the picture is added as a new record to this table
field linked by the PictureID to the main tble.

Signature

Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail

accessuser1308 - 11 Sep 2007 15:46 GMT
Al,

Thank you very much.  I took your advice about the table and subform.  This
is exactly what I wanted.

Thank you

> > Hi Al,
> >
[quoted text clipped - 53 lines]
> Each person in the picture is added as a new record to this table
> field linked by the PictureID to the main tble.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.