Results 1 to 10 of 10
  1. #1
    snowboarder234's Avatar
    snowboarder234 is offline Competent Performer
    Windows XP Access 2010 32bit
    Join Date
    Sep 2011
    Posts
    243

    Concatenate a field to appear on a form

    I need the student's names to appear twice on the form: once in two searchable fields by both first and last name, and then in a second location on the same form in a concatenated string under the student's image.

    The reason the names need to appear in two places is because the form is set up in tabs. Once the users moves to a different tab, other than the Student tab, the student's name no longer is readily visible on the form. For the benefit of the end user, I need a concatenated string to display at all times on a place on the form that is NOT in the tabs.



    This is the error message I received when trying to set this up:
    https://skydrive.live.com/redir?resi...MDMthVrXtvCNO8

    Click image for larger version. 

Name:	errormessage.jpg 
Views:	10 
Size:	86.2 KB 
ID:	12595

    My dilemma is I need to preserve the existing fields in the table that currently lists student in two fields by first and last name. I tried to add an additional field of first and last names to the same table (tblStudent) to concatenate and I obviously got the error message below. How else can I achieve the goal of have the first/last names appear as two searchable fields, and then have a concatenated first/last name field appear on the same form?
    Click image for larger version. 

Name:	Concatenate.jpg 
Views:	13 
Size:	99.9 KB 
ID:	12594
    Graphic image link here:https://skydrive.live.com/redir?resi...D1v3B7DCFAjO4I

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    FYI, I deleted your duplicate thread. The error is because you have the same field in 2 different tables, so you have to specify the table, like:

    TableName.FieldName

    The image is hard to see, so perhaps the SQL of the query would be better.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    snowboarder234's Avatar
    snowboarder234 is offline Competent Performer
    Windows XP Access 2010 32bit
    Join Date
    Sep 2011
    Posts
    243
    Quote Originally Posted by pbaldy View Post
    FYI, I deleted your duplicate thread. The error is because you have the same field in 2 different tables, so you have to specify the table, like:

    TableName.FieldName

    The image is hard to see, so perhaps the SQL of the query would be better.
    SQL as per your request:
    SELECT tblStudent.StudentID, tblStudent.GrantID, tblStudent.LastName AS tblStudent_LastName, tblStudent.FirstName AS tblStudent_FirstName, tblStudent.Project, tblStudent.UCDept, tblStudent.StudentWebPage, tblStudent.TItles_FK, tblStudent.WebsiteTypes_FK, tblStudent.EMail, tblStudent.AdvisorID_FK, tblStudent.CampusID_FK, tblStudent.Active, tblStudent.Interim, tblStudent.Final, tblStudent.Update, tblAdvisor.AdvisorID, tblAdvisor.LastName AS tblAdvisor_LastName, tblAdvisor.FirstName AS tblAdvisor_FirstName, tblAdvisor.Campus, tblAdvisor.AdvisorPg, tblStudent.Photo, tblStudent.Abstract, tblStudent.[LastName] & " " & [FirstName] AS Expr1, tblStudent.FirstName
    FROM tblAdvisor INNER JOIN tblStudent ON tblAdvisor.[AdvisorID] = tblStudent.[AdvisorID_FK]
    ORDER BY tblStudent.LastName;

    Thank you!

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    You see the problem?

    tblStudent.[LastName] & " " & [FirstName] AS Expr1
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    snowboarder234's Avatar
    snowboarder234 is offline Competent Performer
    Windows XP Access 2010 32bit
    Join Date
    Sep 2011
    Posts
    243
    Quote Originally Posted by pbaldy View Post
    You see the problem?

    tblStudent.[LastName] & " " & [FirstName] AS Expr1
    No, sorry, I don't.

  6. #6
    rzw0wr is offline I will always be a newbie
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Indiana
    Posts
    479
    tblStudent.[LastName] & " " & [FirstName] AS Expr1
    tblStudent.[LastName] & " " & tblStudent.[FirstName] as Expr1 - You also have tblAdvisor.FirstName in the query.
    Access does not know which one you want to use.

    Dale

  7. #7
    snowboarder234's Avatar
    snowboarder234 is offline Competent Performer
    Windows XP Access 2010 32bit
    Join Date
    Sep 2011
    Posts
    243
    Quote Originally Posted by rzw0wr View Post
    tblStudent.[LastName] & " " & tblStudent.[FirstName] as Expr1 - You also have tblAdvisor.FirstName in the query.
    Access does not know which one you want to use.

    Dale
    Okay -- I selected the tblstudent. It lets me save the document, but gives me the same error message when I try to switch to datasheet view.
    Link here: https://skydrive.live.com/redir?resid=67BF9D3CB1373507!218&authkey=!ACE5cHEE hTQIg3w
    Click image for larger version. 

Name:	concanate2.jpg 
Views:	11 
Size:	59.8 KB 
ID:	12642

  8. #8
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    You have to type it into the expression.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  9. #9
    snowboarder234's Avatar
    snowboarder234 is offline Competent Performer
    Windows XP Access 2010 32bit
    Join Date
    Sep 2011
    Posts
    243
    I didn't know that was required. Building the expression for this specific task is out of my scope. Can this be addressed in this forum or is it not permitted?

  10. #10
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    It's already been given to you:

    tblStudent.[LastName] & " " & tblStudent.[FirstName] as Expr1

    or in design view simply type in:

    Expr1: tblStudent.[LastName] & " " & tblStudent.[FirstName]
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 7
    Last Post: 12-22-2012, 06:31 PM
  2. Reset autonumber in a concatenate field
    By Fish218 in forum Forms
    Replies: 6
    Last Post: 03-13-2012, 11:58 AM
  3. Replies: 1
    Last Post: 11-01-2011, 05:55 PM
  4. Replies: 6
    Last Post: 04-07-2011, 12:33 PM
  5. Concatenate two fields (text & number) for key field
    By Larry Elfenbein in forum Forms
    Replies: 2
    Last Post: 11-10-2005, 07:45 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums