• Functions don’t work in Windows 2000 (Access 2000)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Functions don’t work in Windows 2000 (Access 2000)

    Author
    Topic
    #398560

    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?

    Viewing 1 reply thread
    Author
    Replies
    • #762949

      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.

      • #762950

        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?

        • #763029

          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.

        • #763030

          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.

    • #763010

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

      • #764060

        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?

        • #764064

          If you select Debug | Compile (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.)

          • #764109

            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

            • #764111

              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.

            • #764142

              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.

            • #764152

              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.

            • #764432

              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).

            • #764433

              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).

            • #764153

              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.

            • #764143

              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.

            • #764112

              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.

            • #764118

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

            • #764119

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

          • #764110

            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

        • #764065

          If you select Debug | Compile (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.)

      • #764061

        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?

    Viewing 1 reply thread
    Reply To: Functions don’t work in Windows 2000 (Access 2000)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: