• VB Forms in Access (VB / Access 97)

    Author
    Topic
    #388804

    I’ve written a DLL which allows users to specifiy an Access table and transfer the contents to an AS/400 system. The DLL has a form which is a progress meter & is displayed during the different stages of the DLL transfer.

    The form is displayed fine when I test from my VB6 environment, everything works how it’s supposed to. However, when I use the same bit of code in Access 97 the progress form isn’t displayed.

    Any ideas on this one? I know you can use DLL forms in Access as I tested another DLL that does some DB sign on stuff, the only difference there is that the form is displayed modally.

    I’m using a function to set the window on top as it is created…

    Public Sub SetWindowOnTop(ByVal lhwnd As Long, Optional ByVal optvbTop As Boolean = True)

    Dim iTopMost As Integer

    iTopMost = IIf(optvbTop, HWND_TOP, HWND_NO_TOPMOST)
    SetWindowPos lhwnd, iTopMost, 0, 0, 0, 0, NOMOVE Or NOSIZE

    End Sub

    This should put the window into focus if it has displayed the form shouldn’t it? Can’t figure it out….!

    Thanks

    Viewing 0 reply threads
    Author
    Replies
    • #684460

      Access deals with child windows in a very strange way. Dialog windows actually show up as normal Windows windows. They have hwnds, and you can see all of the controls on the window as child windows. Access forms on the other hand, only show the currently active control as a separate child window. Everything else shows up as just the window of the form. It’s really odd.

      Anywho… I am attaching a zip file with a little .exe I wrote up in VB. It will display every window on your machine. (It’s a treeview, child windows are child nodes…). Use to to find your window. It is probably opening, but it may not be visible. (My form does let you switch a window to visible or hidden.)

      • #685033

        Thanks for the reply, tried this out with my DLL but couldn’t find the window – it just doesn’t seem to be displaying in Access! Very strange, as all the code is running fine & it’s doing what it’s supposed to, you just can’t see the progress meter.

        Thanks anyway

        • #685129

          It really isn’t necessary to open an Access database (in Access) to do this sort of thing. A VB app should work just fine, as it can work with Access tables – that way your progress bar should be visible.

          • #685139

            The DLL is a generic ‘Transfer’ utility , I want standard Access VBA’ers to be able to use this DLL from within their Access databases. Only a couple of users have full VB.

            Thanks

            • #685148

              They shouldn’t need full VB to run a VB app – just the runtime. Trying to run VB DLLs inside of Access and make the forms behave is a major challenge as Access forms and VB forms work entirely different. Just out of curiosity, why did you write the package as a DLL instead of simply doing it in VBA?

            • #685149

              Becuase I’m using enumerations & events that simply aren’t available in VBA. I’m using low-level IBM Client Access code, you can’t do it in VBA (office 97)

              Maybe I’ll change it into an EXE so it runs in it’s own process…..that should sort it out.

              Thanks anyway.

            • #685362

              Are you stuck with A97? Later versions do support Enums, among other things.

            • #685421

              For the meantime, yes – & maybe in about 6 years time we’ll upgrade to Office XP…!! But good to know enums are supported in later versions…

    Viewing 0 reply threads
    Reply To: VB Forms in Access (VB / Access 97)

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

    Your information: