Results 1 to 12 of 12
  1. #1
    Ardoos is offline Novice
    Windows 8 Access 2007
    Join Date
    Jan 2015
    Posts
    9

    How connect two fields in form

    Hi!



    I tried connect two fields (Name + Surname) from 'Coach' table in form. I created textbox and in Source formant I enter code
    =[Coach.Name]+" "+[Coach.Surname]
    But it doesn't work, in preview i see only "#Name?". I created query and enter this code and in query everything is fine! Why it's wrong in form?

  2. #2
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Is the "Coach" table the Control Source (Data Source) of this Form?
    If it is, if you click on the "Show All Fields" box, it should list those fields as being available. If you do not see them there, then it probably won't work.

    Also, I think the more proper syntax of your desired expression should be:
    Code:
    =[Coach].[Name] & " " & [Coach].[Surname]

  3. #3
    Ardoos is offline Novice
    Windows 8 Access 2007
    Join Date
    Jan 2015
    Posts
    9
    Unfortunately Data Source of Form is another table. I can add fields "Name" and "Surname" separately to form, but still can't connect them. Your syntax also don't work :/

  4. #4
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Why would you be adding fields from a totally different table to this form?
    Is there a relationship between that table and the one the form is based on?
    If so, link those two tables in a query, and use the query as the Data Source of the form.
    You can also then do your calculation in the query, and it will be available to you on the from (I prefer to do most of my calculations at the query level, whenever possible).

  5. #5
    Ardoos is offline Novice
    Windows 8 Access 2007
    Join Date
    Jan 2015
    Posts
    9
    It's form about Club, but I want to enter Coach of this club which is in another table. So I must link this tables in query?

  6. #6
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    You can use syntax like

    [Coach].[Name]

    in a Query, as you've found out, but not in VBA behind a Form nor in a Control's Control Source. The usual way to pull data from a Table that is not part of a Form's Record Source is to use the DLookup() function. Have a look in Help for the particulars for the function.

    Linq ;0)>

  7. #7
    Ardoos is offline Novice
    Windows 8 Access 2007
    Join Date
    Jan 2015
    Posts
    9
    Thanks for help. I think, I'll use query to solve this problem. At present DLookup() is 'slightly' hard for me ;P

  8. #8
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Just be aware that Forms based on Multi-Table Queries are frequently Read-Only! Allen Browne has an excellent article that explains why:

    Why is my query read-only?

    Linq ;0)>

  9. #9
    Ardoos is offline Novice
    Windows 8 Access 2007
    Join Date
    Jan 2015
    Posts
    9
    Thanks for information. Happily this form is only for read, not enter new information. One problem less

  10. #10
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Then you should have no problem!

    Good luck with your project!

    Linq ;0)>

  11. #11
    Ardoos is offline Novice
    Windows 8 Access 2007
    Join Date
    Jan 2015
    Posts
    9
    Thanks for help!

  12. #12
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    It's form about Club, but I want to enter Coach of this club which is in another table. So I must link this tables in query?
    That is how I would probably go around it. Not sure why you are reluctant to do that.
    DLOOKUP will work in most cases, but note that there may be issues with using it (see the first four reasons here: http://allenbrowne.com/ser-42.html).

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

Similar Threads

  1. Replies: 9
    Last Post: 10-29-2013, 12:39 PM
  2. Replies: 1
    Last Post: 10-02-2012, 07:31 PM
  3. Replies: 1
    Last Post: 11-23-2010, 10:41 AM
  4. Replies: 3
    Last Post: 08-06-2009, 11:49 PM
  5. Replies: 5
    Last Post: 03-29-2009, 07:20 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