Page 1 of 2 12 LastLast
Results 1 to 15 of 25
  1. #1
    Blings's Avatar
    Blings is offline Competent Performer
    Windows 10 Office 365
    Join Date
    May 2020
    Location
    London, UK
    Posts
    125

    Displaying a percentage in a control


    I'm struggling to display a percent in the Discount % control which is pulled from the Supplier profile. The value should be 2.5%

    Click image for larger version. 

Name:	DisplayPercentCreditorsReconForm.jpg 
Views:	33 
Size:	136.5 KB 
ID:	45894

  2. #2
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,003
    Try formatting the control source
    =Format([Discount],"Percent")
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  3. #3
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,412
    or just set the format property to percent

  4. #4
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,914
    Hasn't the o/p done that, just that they are likely storing .25?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  5. #5
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,412
    so they are - but if that was the case, you should still see the % char. So now I suspect the value is a text value rather than numeric. Wait to see what the OP comes back with. Perhaps the box in orange should be formatted as well

  6. #6
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,914
    I am even more puzzled now as the source is another control on the same form? Why not just use that source?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  7. #7
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,003
    It's to fool the natives...
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  8. #8
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,914
    Well it worked for me.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  9. #9
    Blings's Avatar
    Blings is offline Competent Performer
    Windows 10 Office 365
    Join Date
    May 2020
    Location
    London, UK
    Posts
    125
    Quote Originally Posted by Minty View Post
    Try formatting the control source
    =Format([Discount],"Percent")
    After testing that access throws the code out like this ""=For"m"at(["d\isc"ou"n"t],Percent)"

  10. #10
    Blings's Avatar
    Blings is offline Competent Performer
    Windows 10 Office 365
    Join Date
    May 2020
    Location
    London, UK
    Posts
    125
    Quote Originally Posted by Ajax View Post
    so they are - but if that was the case, you should still see the % char. So now I suspect the value is a text value rather than numeric. Wait to see what the OP comes back with. Perhaps the box in orange should be formatted as well
    The box in orange is formatted as Percent, however, the value is 0.025 when it should be 2.5%.

  11. #11
    Blings's Avatar
    Blings is offline Competent Performer
    Windows 10 Office 365
    Join Date
    May 2020
    Location
    London, UK
    Posts
    125
    Quote Originally Posted by Welshgasman View Post
    I am even more puzzled now as the source is another control on the same form? Why not just use that source?
    The process behind the logic is when a Supplier is picked, the orange blocks are updated and in return the visible white controls to the left display the values for the user.

  12. #12
    Blings's Avatar
    Blings is offline Competent Performer
    Windows 10 Office 365
    Join Date
    May 2020
    Location
    London, UK
    Posts
    125
    Quote Originally Posted by Welshgasman View Post
    Well it worked for me.
    What did you do? I'm still struggling to get it to display 2.5%.

  13. #13
    kd2017 is offline Well, I tried at least.
    Windows 10 Access 2016
    Join Date
    Jul 2017
    Posts
    1,142
    Quote Originally Posted by Ajax View Post
    so they are - but if that was the case, you should still see the % char. So now I suspect the value is a text value rather than numeric.
    Agreed. OP, double check that the datatype for wherever 0.025 is coming from isn't a string. Playing around with this on my end I could only duplicate your results when the source was a string. I suppose if you had to you could use CDbl() in your Text17 control source

    Quote Originally Posted by Blings View Post
    The process behind the logic is when a Supplier is picked, the orange blocks are updated and in return the visible white controls to the left display the values for the user.
    I'm still not clear on why you need two text boxes here.

  14. #14
    Blings's Avatar
    Blings is offline Competent Performer
    Windows 10 Office 365
    Join Date
    May 2020
    Location
    London, UK
    Posts
    125
    tblSuppliers
    * DiscountPercentageID = Number

    tbluSuppliersDiscount
    * DiscountPercentage = Number
    Attached Thumbnails Attached Thumbnails uSupplierDiscountPercentage.PNG   SupplierDiscountPercentage.PNG  

  15. #15
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,914
    Quote Originally Posted by Blings View Post
    What did you do? I'm still struggling to get it to display 2.5%.
    That was in reply to post 7
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 11-07-2017, 06:07 PM
  2. Replies: 1
    Last Post: 07-19-2014, 01:04 PM
  3. Replies: 2
    Last Post: 08-02-2013, 01:38 AM
  4. Replies: 2
    Last Post: 06-28-2013, 11:15 PM
  5. Replies: 2
    Last Post: 05-13-2011, 02:34 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