Results 1 to 6 of 6
  1. #1
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Jacksonville,NC, USA
    Posts
    705
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Msowcf.dll error with Roundup Function

    I am having trouble with a formula that works in Excel, but not Access.

    ITS =(ROUNDUP([1SEC],1))*10

    AND I GET A #NAME MSG BUT THE DLL FILE THIS REFERS TO IS PRESENT. (msowcf.dll)

    I,M CONVERTING TIME TO POINTS...Can anyone tell me how to fix this problem and make this formula work correctly like in Excel?

    Thank you,

    teachesms@hotmail.com
    Padgett
    NMP <img src=/S/cool.gif border=0 alt=cool width=15 height=15>

    If you can't convince them, confuse them. - Harry Truman <img src=/S/scratch.gif border=0 alt=scratch width=25 height=29>

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Msowcf.dll error with Roundup Function

    There is no roundup function in Access, although there is a round() function that only allows you to specify the number of decimal places. If I remember correctly Round behaves differently between Excel and Access, since Excel rounds .015 to .02 and Access doesn't. You can easily write your own roundup function for Access. Here's a routine of mine called FixedNum that is similar to the Fixed function in Excel and that allows you to specify the number of decimal places and, optionally, whether to roundup:
    <pre>Private Function FixedNum(ByVal dblNumber As Double, _
    ByVal intPlaces As Integer, _
    Optional blnRoundUp As Boolean = True) As Variant
    ' Created by Charlotte Foust
    ' 3/5/99
    ' Similar to Excel Fixed() function
    ' Negative numbers rounded to left of decimal point
    '
    ' Modified 4/8/99 -- handle intPlaces=0
    ' Modified 7/31/2000 -- handle fewer decimal
    ' places than specified in intPlaces.
    ' Modified 3/26/2001 -- cleaned up code and added comments
    Dim dblNum As Double 'holds whole number left of decimal
    Dim strDecimal As String 'holds decimal portion of number _
    converted to string
    Dim lngDecimal As Long 'holds decimal converted from string _
    and rounded to specified places
    Dim intDecPos As Integer 'holds position of decimal point in _
    original string
    Dim intRounder As Integer 'holds the number that determines rounding
    Dim strNum As String 'holds the double converted to string
    Dim blnNegative As Boolean 'holds true if number is negative
    Dim blnTruncate As Boolean 'holds true if intPlaces = 0
    Dim dblReturn As Double 'holds the return value of FixedNum

    'set the Truncate and Negative flags
    If intPlaces = 0 Then
    blnTruncate = True
    End If 'intPlaces = 0
    If dblNumber < 0 Then
    blnNegative = True
    End If 'dblNumber < 0

    ' Extract the whole number
    ' from the double
    dblNum = Fix(dblNumber)
    ' convert the double to a string
    strNum = CStr(dblNumber)
    ' find the decimal point in the string
    intDecPos = InStr(strNum, ".")

    ' if intPlaces<>0 extract the decimal portion
    If Not blnTruncate Then
    ' extract the decimal portion of the double
    strDecimal = Right(strNum, Len(strNum) - intDecPos)
    lngDecimal = CLng(Left(strDecimal, intPlaces))
    Else 'Not blnTruncate
    strDecimal = "0"
    lngDecimal = CLng(strDecimal)
    End If 'Not blnTruncate

    ' extract the rounding determinant from the decimal portion
    If Len(strDecimal) >= intPlaces + 1 Then
    intRounder = CInt(Mid(strDecimal, intPlaces + 1, 1))
    Else 'Len(strDecimal) >= intPlaces + 1
    intRounder = 0
    End If 'Len(strDecimal) >= intPlaces + 1

    ' apply rounding unless blnRoundup = False
    Select Case blnRoundUp
    Case True 'blnRoundUp
    If intRounder >= 5 Then
    lngDecimal = lngDecimal + 1
    End If 'intRounder >= 5
    Case Else 'blnRoundUp
    End Select 'Case blnRoundUp

    ' If intPlaces <> 0, add the decimal
    ' portion back to the base number
    If Not blnTruncate Then
    ' if the number is negative,
    ' subtract the decimal amount
    If blnNegative Then
    dblReturn = dblNum - (lngDecimal / 10 ^ intPlaces)
    Else 'blnNegative
    dblReturn = dblNum + (lngDecimal / 10 ^ intPlaces)
    End If 'blnNegative
    Else ' Not blnTruncate
    Select Case blnRoundUp
    Case True 'blnRoundUp
    'apply rounding
    If CInt(Left(strDecimal, 1)) >= 5 Then
    If blnNegative Then
    dblReturn = dblNum - 1
    Else 'blnNegative
    dblReturn = dblNum + 1
    End If 'blnNegative
    Else 'CInt(Left(strDecimal, 1)) >= 5
    dblReturn = dblNum
    End If 'CInt(Left(strDecimal, 1)) >= 5
    End Select 'Case blnRoundUp

    'set the return value
    dblReturn = dblNum
    End If ' Not blnTruncate

    FixedNum = dblReturn
    End Function 'FixedNum(ByVal dblNumber, _
    ByVal intPlaces, _
    Optional blnRoundUp) As Variant</pre>

    You could use bits of this to create your RoundUp function.
    Charlotte

  3. #3
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Jacksonville,NC, USA
    Posts
    705
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Msowcf.dll error with Roundup Function

    Charlotte,

    Always and forever grateful that you are here. You are a real Pro. Thanks for all you do. You are a treasure, and your help is worth mega $$$$$$.

    Nannette
    NMP <img src=/S/cool.gif border=0 alt=cool width=15 height=15>

    If you can't convince them, confuse them. - Harry Truman <img src=/S/scratch.gif border=0 alt=scratch width=25 height=29>

  4. #4
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Msowcf.dll error with Roundup Function

    You can send my check care of WOPR.Com! <img src=/S/wink.gif border=0 alt=wink width=15 height=15> <img src=/S/grin.gif border=0 alt=grin width=15 height=15>
    Charlotte

  5. #5
    New Lounger
    Join Date
    Feb 2001
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Msowcf.dll error with Roundup Function

    I might opt for your function, too...

    According to the Access (2000) help file, the round and mround functions should be available - if not, a missing or not-properly-installed Msowcf.dll file apparently is to blame.

    Do you have any ideas how to make this work? I sure have the file - but apparently Access doesn't know that. And I would rather do something specific than just blankly reinstall... <img src=/S/hairy.gif border=0 alt=hairy width=15 height=15>

    Rgds,
    Ole

  6. #6
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Msowcf.dll error with Roundup Function

    You might try doing a detect and repair from the Help menu. I have no problem using Round() on my Access 2000, even on the machine with both 2000 and 97 installed. Round() is actually a VBA function rather than Access/Jet, but a detect and repair might fix the connection.
    Charlotte

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •