Results 1 to 10 of 10
  1. #1
    azhar2006's Avatar
    azhar2006 is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2012
    Posts
    528

    Add a character in a field containing a number?

    Hello all


    I have a query is
    How do I add a character in a field contains a number?
    For instance
    Click image for larger version. 

Name:	69.JPG 
Views:	14 
Size:	18.8 KB 
ID:	14998

  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,641
    You can concatenate:

    FieldName & "mg"
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    azhar2006's Avatar
    azhar2006 is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2012
    Posts
    528
    Thanks for your help
    But there is another problem
    Click image for larger version. 

Name:	110.JPG 
Views:	13 
Size:	17.7 KB 
ID:	15002Click image for larger version. 

Name:	88889.JPG 
Views:	13 
Size:	20.2 KB 
ID:	15003

  4. #4
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    If your expr4 is a formula you have to execute the formula based on the individual items then add the string

    make your formula in expr4

    [lounce]*(quantity* purity) & "mg"

  5. #5
    azhar2006's Avatar
    azhar2006 is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2012
    Posts
    528
    Thank you very much
    There is another problem
    How can I collect my column that contains number + character
    I use =Sum([Expr5])
    But it seems to me an error
    Click image for larger version. 

Name:	55554444.JPG 
Views:	11 
Size:	14.1 KB 
ID:	15005

  6. #6
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    personally I would not put the text values in your query at all. It looks like you are trying to format it for a form or a report so I would concantenate the MG or GR or whatever other abbreviation you have on the report or form so you don't run into this problem. If you do it in your query you'd have to carry both the number and the string to be able to report it on a form/report anyway (or take an additional step to UN-parse your value)

    In other words in your query let your numbers be numbers in your query.

    then on your form or report you can have the formula (for a total of expr5)

    = sum([expr5]) + " GR"

  7. #7
    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
    To take

    1122000, GR

    and get

    1122000

    you can use the Val() Function:

    =Sum(Val([Expr5]))

    Linq ;0)>

  8. #8
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,630
    I agree with rpear. Don't concatenate the 'mg' in query.

    Consider using report Grouping & Sorting with aggregate calcs in footers. This will allow display of detail records as well as summary calcs.

    The 'mg' can be concatenated in textbox expression or be a label.
    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.

  9. #9
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    Quote Originally Posted by Missinglinq View Post
    To take

    1122000, GR

    and get

    1122000

    you can use the Val() Function:

    =Sum(Val([Expr5]))

    Linq ;0)>
    the whole point linq is that he's concantentating it in a query, just to unconcantenate it in a form so he can total the number portion, then put the text string back on the end. It makes no sense. What I'm proposing is that he leaves his numbers as numbers until it's actually time to display them (on a form or on a report)

  10. #10
    azhar2006's Avatar
    azhar2006 is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2012
    Posts
    528
    Thank you very much to all of you
    To help me

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

Similar Threads

  1. Replies: 8
    Last Post: 04-14-2013, 01:33 PM
  2. 4th character of a field
    By Rhubie in forum Access
    Replies: 20
    Last Post: 08-28-2012, 04:04 PM
  3. Prefix character in ID field
    By Zbeibu in forum Access
    Replies: 2
    Last Post: 05-14-2012, 07:21 AM
  4. Fixed character length of field
    By tylerg11 in forum Access
    Replies: 3
    Last Post: 09-29-2011, 11:58 AM
  5. filter by the number of character
    By bangemd in forum Access
    Replies: 1
    Last Post: 06-30-2009, 10:33 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