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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem on Passing Parameters! Need Help/Advice!

Status
Not open for further replies.

splaisance

Programmer
Jul 2, 2001
67
US
I have a visual basic program that needs to be split into two parts. A selection screen for interactive use where the user will decide what options they want a report to run with. The second part is actually running the selected report.

I know how to pass parameters when calling a program and retrieving them via GetCommandLine(), etc. But this particular program will have over 10 parms to pass, one of which is a varying size.

What is a good way to do this? Is there a simple solution I am missing? Any comments/advice/suggestions are welcome!!!


Thanks!

Shannon
 
Hi Shannon,
Do you really need to split the application in to two ? you can pass the variables required by argument to a printing module. For example if the user selects report A and requires 2 copies you could have a sub or function such as :-

Function RunReport(cReport AS String,iCopies AS Long)
' Code to print report etc
End Function

From your calling form you would have a button with code to get the data from the input screen and call it.

If you really have to split them in to two applications then I would write the data out to a text file or database if you have one connected then get the reporting program to read the settings in before printing.

Hope this helps.

Nick W


 
Nick

Yeah I have to split the programs apart because the report/creation/print part will also be called by batch programs.

ie: the report/creation/print program needs ability to be run on demand or in a batch stream.


hmmmm i really don't want to write out to a text file or something like that... but if I can't figure something else out I will.

Thanks :)

Shannon
 
hey splaisance,

this is the kinda stuff, i deal with all the time. the interactive thing uses no computer resources nowadays, serious number crunching should be periodically interrupted by doevents. don't split the application, make passing this mass of variables occur in fewer places, or make it an object and then you don't care how inefficient it is.

make the parameter that varies in size into an object, then you can pass it by reference.

john
 
John,

Thanks for your reply. The application as is works fine and I don't have problems with it. The problem is it is 3 different reports where the user selects options - which report to run and other options for how to run it. (ex: print to a printer and/or out to excel, exclude specific companies, etc.)

I need the reports to be printed from a scheduled task - say at night when no one is available to to input these parameters. Even if I didn't split the program and put a trigger to decide if the program ran interactive or without user input - I still would need to figure out how to pass all of these parameters to the program. That is the problem I have.... There are 14 options total that can be modified - and one can expand depending on how many companies a user chooses to exclude. I just can't figure out what is the best way to get this information to the program - say from another program or from a job scheduler.

Does that explain what I need better?

Thank you for your help!!

X-)

-Splaisance
 
Shannon,
Reading your reply to John I think the only way you could get the print program to reliably run is to store the user requirements within the database. When the schedular starts your print app all you have to do is read in the data to an array or single variables and off it will go. You could also add in a print date so if the report is not required until a certain date then skip it until system date equals print date then once printed remove the data from the table.

Nick W
 
I think the easiest way to get what you want would be the following:

Dim aryParms() As String
aryParms = Split(Command$, "|")

If the command line paramaters that were passed in was:
Parm 1|Parm 2|Parm 3

aryParms would contain
aryParms(0) = "Parm 1"
aryParms(1) = "Parm 2"
aryParms(2) = "Parm 3"

-Adam T. Courtney
Stratagem, Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top