PDA

Click to See Complete Forum and Search --> : Can a Data control be passed as a variable to a subroutine?


Paylo
Jul 18th, 2000, 04:20 AM
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.

Jimbob
Jul 18th, 2000, 10:45 AM
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

Paylo
Jul 18th, 2000, 12:01 PM
Thanks! I think that should solve my problem.