If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
ACC2000: change string to int
I have a customer number that is a string, but I need to change it to an
integer variable. Assigning: iCust = sCust does not work. (I just want to drop leading zeroes in the string. It can stay a string if that's easy.) Is there a function to convert string to int? I could not find one in Access help. String() seems to convert a numeric to a string data type. Thanks. |
#2
|
|||
|
|||
ACC2000: change string to int
Try use:
Int(sCust) or Val(sCust) If you want to find Help on these types of functions, first open any module and then open Help. -- Duane Hookom Microsoft Access MVP If I have helped you, please help me by donating to UCP http://www.access.hookom.net/UCP/Default.htm "A Man" wrote: I have a customer number that is a string, but I need to change it to an integer variable. Assigning: iCust = sCust does not work. (I just want to drop leading zeroes in the string. It can stay a string if that's easy.) Is there a function to convert string to int? I could not find one in Access help. String() seems to convert a numeric to a string data type. Thanks. |
#3
|
|||
|
|||
ACC2000: change string to int
Val(String) will return the value of the string; however it does return zero
if the string is just spaces and will error if the string is null Val("22.5") Better testing is If IsNumeric(String) Then Val(String) Or you could use IIF(IsNumeric(String),Val(String),Null) -- John Spencer Access MVP 2002-2005, 2007-2008 Center for Health Program Development and Management University of Maryland Baltimore County .. "A Man" wrote in message . net... I have a customer number that is a string, but I need to change it to an integer variable. Assigning: iCust = sCust does not work. (I just want to drop leading zeroes in the string. It can stay a string if that's easy.) Is there a function to convert string to int? I could not find one in Access help. String() seems to convert a numeric to a string data type. Thanks. |
#4
|
|||
|
|||
ACC2000: change string to int
|
Thread Tools | |
Display Modes | |
|
|