Mombu the Programming Forum

Go Back   Mombu the Programming Forum > Programming > Text to Number
User Name
Password
REGISTER NOW! Mark Forums Read




Reply Bookmark and Share
1 25th April 02:57
robfms
External User
 
Posts: 1
Default Text to Number



One option I would suggest is creating a table (commonly referred to as a
lookup table) that contains two fields: CharValue, NumValue

When you want to get the numeric value of the character, do a search for its
respective character value.

HTH

--
Rob

FMS Professional Solutions Group
http://www.fmsinc.com/consulting

Software Tools for .NET, SQL Server, Visual Basic & Access
http://www.fmsinc.com

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  Reply With Quote


 


2 25th April 02:59
mark hammer
External User
 
Posts: 1
Default Text to Number



Another, probably simpler, solution is to use an IIF statement, i.e.,

varMyResult = IIf([MyFieldName]="M",1,2)
will return 1 if MyFieldName is "M", and 2 otherwise.

--Mark Hammer
  Reply With Quote
3 30th April 13:30
ronald w. roberts
External User
 
Posts: 1
Default Text to Number


Not sure what you want when to say M=1, F=2. But if you
want to convert letter to a number for both lower and upper case
then this will work.

If Not IsNull(Me!txtLetter) Then
Select Case Asc(Me!txtLetter)
Case 65 To 90
Me!txtNumber = Asc(Me!txtLetter) - 64
Case 97 To 122
Me!txtNumber = Asc(Me!txtLetter) - 96
Case Else
Me!txtNumber = 0
End Select
End If

Ron
  Reply With Quote
Reply


Thread Tools
Display Modes


Some other forums that might be of your interest : Development, Ada, Apple script, Assembler, Awk, Beos, Basic, C, C++, C#, C# .net, .net, .net frameworks, Asp .net, Clarion, Clipper, Clos, Clu, Cobol, Coldfusion, Delphi, Dylan, Eiffel, Forth, Fortran, Haskell, Hermes, Icon, Idl, Java, Java script, Jscript .net, Jcl, Linoleum, Lisp, Lotus, Limbo, Logo, Ml, Mumps, Oberon, Postscript, Pop, Pl1, Prolog, Python, Ruby, Pascal, Perl, Php, Rebol, Rexx, Sed, Sather, Scheme, Smalltalk, Tcl, Vhdl, Vrml, Visual basic, Visual basic .net, Yorick, Mysql, Omnis, Postgresql, Xbase, Access, Oracle, Adabas, Berkeley, Btrieve, Filemaker, Gupta, Db2, Informix, Ingres, Mssql server, Object, Olap, Paradox, Rdb, Revelation, Sybase, Theory, Dbase, Html, Java script, Css, Flash, Photoshop, Corel script, Xml, Tech, Beos, Gem, Hp48, Hpux, Linux, Mac, Ms-dos, Os2, Palm, Solaris, Ti99, Windows, Xenix, Aos, Chorus, Geos, Inferno, Lantastic, Lynx, Mach, Minix, Netware, Os9, Parix, Plan9, Psos, Qnx, Xinu, Sco, Unix, Aix, Aux, 386bsd, Bsdi, Freebsd, Netbsd, Openbsd, Ultrix, Amd, Intel, Aptiva, Buz, Deals, Homebuilt, Overclocking, Programming, Extra forums


Copyright © 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666