Results 1 to 5 of 5

Thread: Calling my ActiveX Sub

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 1999
    Location
    Brossard, Québec, Canada
    Posts
    241

    Post

    I Have a procedure in an activex control that when I try to call I get and "Object required" error... any ideas?

    Here's the code

    Activex sub:

    Public Sub Repopulate()
    Dim DB As Database
    Dim rstRecordSet As Recordset
    Dim Entete As String
    Dim Data As String
    Dim I As Integer

    Set DB = TechGrid.dsDatabase
    Set rstRecordSet = DB.OpenRecordset(TechGrid.dsRecordset, dbOpenSnapshot)

    Flexgrid.Rows = 2
    Flexgrid.Cols = rstRecordSet.Fields.Count
    Flexgrid.FixedRows = 1

    'Faire les entetes de colonnes...
    For I = 0 To rstRecordSet.Fields.Count - 1
    If I = 0 Then
    Entete = rstRecordSet.Fields(I).Name
    Else
    Entete = Entete & Chr(9) & rstRecordSet.Fields(I).Name
    End If
    Next I

    'Populer la grille
    rstRecordSet.MoveFirst
    Do While Not rstRecordSet.EOF
    For I = 0 To rstRecordSet.Fields.Count - 1
    If I = 0 Then
    Data = rstRecordSet.Fields(I).Value
    Else
    Data = Data & Chr(9) & rstRecordSet.Fields(I).Value
    End If
    Next I
    Loop
    End Sub


    Now I call my procedure as so:

    TechGrid1.Repopulate

    Please Help.

  2. #2
    Lively Member
    Join Date
    Jun 1999
    Location
    Ireland
    Posts
    96

    Post

    Are you calling the Sub from a seperate Program with an instance of the OCX in the Program.

    If so it should work, I think.

    Try creating a group project, by opening the Active Project and adding a project to it.

    This will allow you to see exactly what line the error is occuring on, maybe the object required is within the OCX. This method will allow you to debug the OCX.

    Hope this helps,

    Steve.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Oct 1999
    Location
    Brossard, Québec, Canada
    Posts
    241

    Post

    Thank you very much.... I'l try that!

  4. #4
    New Member
    Join Date
    Oct 1999
    Location
    St. Louis, MO, USA
    Posts
    8

    Post

    If your app is an ActiveX DLL, then from the second program you need to get a handle to the first program.

    Example

    Dim MyGrid

    Set MyGrid = CreateObject("objectname.classname")

    MyGrid.Repopulate

    The project group is a good way to test, but it more tightly couples the objects, making it harder to deliver updates.

    ------------------
    WebMan

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Oct 1999
    Location
    Brossard, Québec, Canada
    Posts
    241

    Post

    HEHE... you kinda lost me there Webman...

    What I'm trying to do is an activex that I can use in a .exe just as I would use msflexgrid. My activex has MsFlexGrid in it. I just want to be able to use mine without as easly as say a listbox in MsAccess Where I would just have to set it's recordsource (a property) and then call the repopulate method.

    can u help

    P.S.: I tried what you said SteveS but the debugger wouldn't go in my activex code.

Posting Permissions

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



Click Here to Expand Forum to Full Width