Results 1 to 3 of 3

Thread: Can a Data control be passed as a variable to a subroutine?

  1. #1

    Thread Starter
    Member
    Join Date
    Jul 2000
    Location
    Hong kong
    Posts
    53

    Question

    Hello All,
    I just have a small question that might seem trivial but nevertheless important to my current project. The first stage of my program involves loading up MDB files and displaying them on a grid (MSflex, DBgrid whatever...), right now I have a grid interconnected to a hidden data control. It works all fine, except my boss has asked that the function be portable, that means the subroutine that puts the information on the grid must have a parameter passing in the name of the data control! (cause the form might be different in another program)

    right now I have:
    private sub showgrid(datacontroller as data)
    'some code here
    end sub

    The code above is giving me a type mismatch. I am wondering is it even possible to pass in the data controller as a variable? Is there any other solution? Thanks in advance for any help!

    Francis.

  2. #2
    Hyperactive Member
    Join Date
    Apr 2000
    Location
    Isle of Man
    Posts
    276
    you could try passing it as a control object, eg

    Dim MyObj as Control

    Set Myobj = DataControl1

    Call MyFunction(myObj)

    you can then manipulate MyObj in the calling function

  3. #3

    Thread Starter
    Member
    Join Date
    Jul 2000
    Location
    Hong kong
    Posts
    53

    Wink

    Thanks! I think that should solve my problem.

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