Results 1 to 5 of 5
  1. #1
    theleebaldwin is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2015
    Location
    Calhoun, GA
    Posts
    3

    Concatenation in Form

    I am creating a form that users will use to input a style number and color number for a particular product. I want to concatenate these items together with a hyphen in between them. What would be the best practice way to do this? I currently have the following in the Default Value on the Data tab: =[txtStyleCode] & "-" & [txtColorCode]. Will this achieve the desired result and align with best database practices?

  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,642
    That won't likely save the value, if that's what you're after. I'd simply display it with that in the control source; we don't typically save calculated values. There is a new calculated field data type, so that may be a solution too.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    theleebaldwin is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2015
    Location
    Calhoun, GA
    Posts
    3
    Thanks pb. I want to save this calculated value as I am going to use it as my primary key and relate it to a field in a UPC table. I am assuming (newbie here) that I can use a submit button and run a query that will take my information and save it into my table including this calculated field. Am I on the right path to success?

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,633
    Saving the value from a form bound to the table can simply be:

    Me!fieldname = Me.textboxname

    The real trick is figuring out what event to put this code into. Try the form BeforeUpdate event.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    theleebaldwin is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2015
    Location
    Calhoun, GA
    Posts
    3
    Thanks June7. It will be a few more days to get to the point where I can try this so I will close the thread and if need be I will reopen it.

    Lee

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

Similar Threads

  1. Concatenation
    By cbende2 in forum Access
    Replies: 14
    Last Post: 08-01-2014, 01:32 PM
  2. Concatenation
    By lantoni in forum Access
    Replies: 31
    Last Post: 03-06-2014, 07:29 AM
  3. concatenation issue
    By SuicidalDriver in forum Queries
    Replies: 11
    Last Post: 07-31-2013, 04:42 AM
  4. Concatenation
    By Rhubie in forum Access
    Replies: 3
    Last Post: 08-30-2012, 05:09 PM
  5. field concatenation on a form
    By theosgood in forum Forms
    Replies: 3
    Last Post: 06-04-2012, 04:55 PM

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