Results 1 to 2 of 2
  1. #1
    Mclaren is offline Competent Performer
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Feb 2010
    Location
    Johannesburg
    Posts
    164

    Dividing a number stored as text

    I have used the code below to get the Machine name and then convert to ASC. I want to then take the value a divide that value by any number, for instance 2.
    When i divide my variable that stores the converted information i get a funny result: EG: if the pc name is "MIASROOM" the value returned after conversion is :7773658382797977, when divded it becomes :3.88682919139899E +15



    Option Compare Database
    Public vThisPCName As String
    Public vThisPCNameASCii As String

    Private Declare Function apiGetComputerName Lib "kernel32" Alias _
    "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
    Function fOSMachineName() As String

    'Returns the computername
    Dim lngLen As Long, lngX As Long
    Dim strCompName As String
    lngLen = 16
    strCompName = String$(lngLen, 0)
    lngX = apiGetComputerName(strCompName, lngLen)
    If lngX <> 0 Then
    fOSMachineName = Left$(strCompName, lngLen)
    Else
    fOSMachineName = ""
    End If
    End Function

    Function Convert_ThisPCName()
    'Get machine name and assign to variable MyMachineName
    vThisPCNameASCii = ""
    vThisPCName = fOSMachineName

    'Convert Machine name to ASC and save to variable vThisPCNameASCii

    Dim i As Integer
    Dim LengthOfText As Integer
    LengthOfText = Len(vThisPCName)
    For i = 1 To LengthOfText
    vThisPCNameASCii = vThisPCNameASCii & CStr(Asc(Mid$(vThisPCName, i, 1)))
    Next i
    End Function

  2. #2
    Mclaren is offline Competent Performer
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Feb 2010
    Location
    Johannesburg
    Posts
    164
    OK, i got it, its the scientific equivilant. so yeah. me is doff.

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

Similar Threads

  1. Help dividing two fields in a query
    By aronnov in forum Access
    Replies: 2
    Last Post: 04-29-2010, 12:34 PM
  2. Report TextBox printing ID Number, not text
    By ZipDoc in forum Reports
    Replies: 8
    Last Post: 02-01-2010, 12:30 PM
  3. Rounded number inside of text
    By Lockrin in forum Access
    Replies: 6
    Last Post: 01-27-2010, 12:26 PM
  4. Concatenation of Text and Number
    By diane802 in forum Reports
    Replies: 67
    Last Post: 01-26-2010, 03:37 PM
  5. exporting text produces a number
    By greend in forum Import/Export Data
    Replies: 0
    Last Post: 07-12-2006, 03:55 PM

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