Results 1 to 4 of 4
  1. #1
    2 Star Lounger
    Join Date
    Apr 2008
    Posts
    188
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I am trying to take the data entered on three unbound fields "Title", "FN" and "LN" and have it automatically populate a bound field "Name" on a form.

    I can not figure out the code to do it or I am using the code in the wrong place. I keep getting a message that the file "Name" is read only.

    I'm stuck. Can anyone help.

    Thanks.

    Paul

  2. #2
    5 Star Lounger AndrewKKWalker's Avatar
    Join Date
    Apr 2001
    Location
    Cambridge, UK
    Posts
    1,020
    Thanks
    0
    Thanked 3 Times in 3 Posts
    How are you doing this at the moment
    Are you using code and what does the code look like?
    Is it triggered by a button or an After_Update event?
    That would help us find the problem.

    However, as a general rule, you should not use NAME as the name of a field.
    Name is a property of many objects in VB and this causes issues, which may or may not be where your problem lies.

    If you are using a field called NAME, you need to enclose the name in [.....] brackets as [Name]

    Suppose the Code was on a button , and you are Concatenating the Fields together to give the entry in the name field

    Something like [Name]=xxxxxxxx where xxxxx is the expression that joins the fields together
    IF the field Name is NOT on the form use Me![Name]=xxxxxx

    But don't use Name without the brackets and definitely not Me.Name because that would be the name of the form.

    There might be some ideas in there if not post back something with a bit more specific detail.
    Andrew

  3. #3
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts
    If you have fields for "Title", "FN" and "LN" in the table, then you should not also store the full name in the table, as you are then storing the same info twice.

    Instead you Concatenate the fields in a query, then use the concatenated field as the control source for the field on the form.

    In the query

    FullName:Trim([title] & " " & [FN] & " " & [LN])

    The Trim removes the leading space for people who don't have a Title.

    You will not be able to edit this field on the form, as it is calculated.
    Regards
    John



  4. #4
    2 Star Lounger
    Join Date
    Apr 2008
    Posts
    188
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks to both of you for your comments.

    Using your suggestions I was able to resolve my problem.

    Paul

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •