Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

call a form with a parameter

Status
Not open for further replies.

BraveDave

Programmer
Jun 16, 2005
9
0
0
US
Hey guys,
I need to pass to some of my forms a parameter, while I'm loading them. For example, if I have a form with an ADODC Control and I would like to load the form with a diffrent RecordSource each time, I would like to be able to pass to the form that RecordSource, when I call it from another form.
Is there a way to pass a var to a form while calling it? Something like calling the app with a parameter (For example Project1.exe Hello) and use the Command var.
Right now I'm using a public Vars in the module. I'm sure there's a better way.
Thanks,
Dave.
 
Actually, there's not a better way. The only other ways I know of are a public var in the form being called (set it before showing the form) or a public var in the calling form (reference it from the form being called).

You can do what you are thinking in VB .NET, but not in earlier versions of VB.

I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson
 
There was another thread, not too long ago, that may be helpful. thread222-1080798

The idea is, you create a public function/sub on the form, then, instead of calling the show method, you call the function. Inside the function, you call show.

I would agree with jebenson that vb.net has a better way of doing this. However, my VB6 solution in the referenced thread works pretty well also.

Hope this helps.

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
Thank you both for the answers.
gmmastros, I've tried that one too..
I guess it's not possible in VB6, eh? Well, thanks anyway.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top