change text to number

masoud_sedighy

Registered User.
Local time
Today, 04:00
Joined
Dec 10, 2011
Messages
132
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.
 
Try Replace and CLng methods..
Code:
Dim lngChkNum As Long, strToCheck As String
strToCheck = "1390/02/01"
lngChkNum =[URL="http://www.techonthenet.com/access/functions/datatype/clng.php"] CLng ([/URL] [URL="http://www.techonthenet.com/access/functions/string/replace.php"]Replace([/URL]strToCheck), "/", "")
 

Users who are viewing this thread

Back
Top Bottom