Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Convert string to integer ISSUE

Status
Not open for further replies.

SidCharming

Technical User
Jun 18, 2003
73
US
I have a proprietary front end to my access mdb that stores numerical values as strings. To add to the issue is the value is stored as a 7 place string. If value entered was a 4 (four), the db stores it as [teal]"4 "[/teal].

By using [tt][teal]cint(trim([field]))[/teal][/tt] I can pull out the '[teal]4[/teal]' as an integer with no problems. However when there is no value entered it is recorded as [teal]" "[/teal] and gets angery when I try and make it a null value.

I tried [tt][teal]iif(trim([field])="", null, cint(trim([field])))[/teal][/tt] with only ERRORS.

HELP!


Sid from Minnesota
 
Danvlas,

Thank you for the very useful tool. I tried looking it up with the Access 02 help with no results. I found some info online (web) that indicated it truncates a string pulling the first characters that resemble a number into a numeric value... with that I found the Val([field]) did not need the Trim function.

[red]Thank you tons![/red] I had been working on this for greater than half the day today!



Sid from Minnesota
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top