Results 1 to 2 of 2
  1. #1
    masoud_sedighy is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Dec 2011
    Posts
    78

    covert special text to number

    hello



    in my table there is a text field that it's type is text. and is something like this "1390/02/01"now i like to remove these "/" and use that like number for example "13900201" in the VBA code. because i want to use it in the if statement like below.please help how i can?

    int number1=13920223
    text1="1390/02/01"

    after changing text1 to number2

    if (number1>13900201)

    {

    }

    Best regards.

  2. #2
    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 the Replace() and Val() Functions to do that, where TargetField is the name of the Control holding the original data:

    Val(Replace(Me.TargetField, "/", ""))

    will take

    1390/02/01

    convert it to

    13900201

    and allow Access to see it as a Number.

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

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

Similar Threads

  1. Replies: 9
    Last Post: 03-22-2013, 06:37 AM
  2. convert number to text number like in cheque
    By ravideep in forum Reports
    Replies: 1
    Last Post: 03-12-2013, 05:55 AM
  3. Replies: 2
    Last Post: 07-21-2012, 01:21 AM
  4. Replies: 11
    Last Post: 07-20-2010, 06:55 AM
  5. Replies: 4
    Last Post: 08-27-2009, 01:21 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