Results 1 to 13 of 13
  1. #1
    New Lounger
    Join Date
    Dec 2003
    Location
    Bristol, Avon, England
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Functions don't work in Windows 2000 (Access 2000)

    I have an Access 2000 database which works perfectly on my PC (Windows 98) - however when I load it onto a PC using Windows 2000 or NT I get a message saying that there are function errors and do I want to debug. I know the functions work fine - how do I tell this to the PC with Windows 2000/NT?

  2. #2
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,623
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: Functions don't work in Windows 2000 (Access 2000)

    It sounds as if you have a missing reference in your database on the 2000 PC. Open any module in design mode and then click Tools/References and look for one that is missing.
    Wendell

  3. #3
    New Lounger
    Join Date
    Dec 2003
    Location
    Bristol, Avon, England
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Functions don't work in Windows 2000 (Access 2000)

    I tried that already - my first thoughts were that the reference libraries were not the same but I have change them.
    stdole2.tlb is the only one that has a different file location on Windows 2000
    c:wnttsystem32stdole2.tlb as opposed to c:windowssystemstdole2.tlb
    This might explain why the database might not be able to find objects but I am not sure about functions.

    The other reference libraries are VBE6.dll, MSACC9.OLB, SSADO15.dll and these are all in the same location in Windows 2000 PCs

    Could it have anything to do with whether it is a private function, function or public function or other?

  4. #4
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Functions don't work in Windows 2000 (Access 2000)

    Have you been into debug and had a look at the problem from the debug perspective?

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

    Re: Functions don't work in Windows 2000 (Access 2000)

    Are you using any Win API calls? If so, make sure your declarations are current. I believe Win98 would handle 16 bit calls, but Win2k only handles the 32 bit calls.
    Charlotte

  6. #6
    New Lounger
    Join Date
    Dec 2003
    Location
    Bristol, Avon, England
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Functions don't work in Windows 2000 (Access 2000)

    Pat - thanks for your advice. The functions seem to be working fine, at least in the Windows 98 version.

    Charlotte - how do I make sure that my "declarations are complete" - I have a hunch this could be it. What must I do to convert/handle it?

  7. #7
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Functions don't work in Windows 2000 (Access 2000)

    If you select Debug | Compile <project> (in the Visual Basic Editor, on a Win2000 machine), do you get an error message? If so:
    - What is the exact message?
    - What is highlighted when you click OK?
    If you get a runtime error (on a Win2000 machine):
    - What is the exact message?
    - What is highlighted when you click Debug?

    (BTW, I removed the duplicate of your reply - you don't need to repeat the same text in reply to several posts.)

  8. #8
    New Lounger
    Join Date
    Dec 2003
    Location
    Bristol, Avon, England
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Functions don't work in Windows 2000 (Access 2000)

    I seem to be getting a bit closer to the solution.

    The functions which do not work as far as I can tell all contain a reference to an activeX date picker control - Microsoft date and time picker, version 6.0 The file is called MSCOMCT2.OCX and in Windows 98 resides at c:/Windows/system. Since this control is not available in Windows 2000 I have replicated the directory/file structure and registered the control within access on the Windows 2000 PC.

    The error message I get on the Windows 2000 PC is "runtime error 11" cannot divide by zero which suggests to me that it is unable to read the control possibly? But I don't know how to rectify this.

    An example of a rogue function is:

    Public Function Per1000dateward()
    'Ctldatepickerto/from refers to an activeX control MSCOMCT2.OCX
    Per1000dateward = 365 / ([Forms]![FrmWards].[CtlDatePickerTo] - [Forms]![FrmWards]![CtlDateFrom])
    End Function

  9. #9
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Functions don't work in Windows 2000 (Access 2000)

    You say that you have registered mscomct2.ocx in Access, I assume that means that you have set a reference in Tools | References... But have you registered it in Windows? To do so, select Run... in the Windows Start menu, and type

    regsvr32 c:windowssystem32mscomct2.ocx

    then press Enter or click OK. Substitute the exact path where you put mscomct2.ocx.

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

    Re: Functions don't work in Windows 2000 (Access 2000)

    In Win2k, the ocx is at C:WINNTSystem32MSCOMCT2.OCX, at least it is on my machine.
    Charlotte

  11. #11
    New Lounger
    Join Date
    Dec 2003
    Location
    Bristol, Avon, England
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Functions don't work in Windows 2000 (Access 2000)

    Tried registering the MSCOMCT2.OCX control in Windows and it said it had done it successfully but this hasn't cured the problem.

    The error is saying "can't divide by zero. On opening the form the control defaults to todays date and time. According to the function this would indeed give a zero reading i.e. today- today = 0

    To get round this I have tried changing the default date value of the control but it doesn't seem to want to stick. Besides, the value is the same as that on the Windows 98 PC which works fine.

    Any other ideas - I feel we are getting close.

  12. #12
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Functions don't work in Windows 2000 (Access 2000)

    If the two dates are the same, you should get the divide by zero error, irrespective of the Operating System. You could build in a check to avoid problems if the two controls have the same value.

  13. #13
    New Lounger
    Join Date
    Dec 2003
    Location
    Bristol, Avon, England
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Functions don't work in Windows 2000 (Access 2000)

    Problem solved...I think. The function which relates to a query which provides the detail for a subform meant that the subform could not work because on opening the main form the dates were exactly the same hence the "can't divide by zero" message. I have no explanation as to why the exact same function works on one operating system and not the other. One of those many unsolved microsoft mysteries I guess. Thanks everyone for your suggestions.

    Oh yes the work around was simply to put +1 next to one of the control references in the function. (with the data I am using this doesn't distort the outcome).

Posting Permissions

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