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!

Passing arguments to VB6 executable from Compuware's TrackRecord

Status
Not open for further replies.

jbeale

Programmer
Dec 6, 2000
14
US
I am trying to pass the contents of a field in Compuware's TrackRecord to a VB6 executable. The information below the line states the Help text in TrackRecord:
----------------------------------------------------------
Executable Button Properties
Administrators can add a button to a type to launch an external application.

Use Properties to specify:

The file name of the program that the executable button will open

For example, enter "notepad.exe" to have the button launch the Windows Notepad accessory

The Parameter control string field lets you specify the command line parameters with which the executable file can be called

For example, the entry &quot;test&quot; will launch Notepad and open the file named test.txt, or will create a new test.txt if none exists. You can also use the %f &quot;<fieldname>&quot; parameter to launch the executable with the contents of a named field on the item as the parameter passed to the executable.
-----------------------------------------------------------
The last sentence above the line is the one I am confused with. In my TrackRecord form, I have a field called Enterprise Code (a 3 character field). I want to send the contents of Enterprise Code and automatically place this information into the Enterprise Code field in my VB application. Based on the syntax above, I am have put the following in the parameter control string property in TrackRecord: %f &quot;<Enterprise Code>&quot;
Does anyone out there now how I can make this work??!!
I would appreciate any direction.
Jody

 
jbeale,
You don't want to use the %fieldname parameter. I'm assuming that you don't have the code to read the parameter in your VB project. If not, you need to add this code to your VB startup form to read the parameter from the command line. The function 'Command()' returns the command line parameters as a string

Code:
Private Sub Form_Load() 

   Dim CmdArgs As String
   Dim ECode As Long 

   CmdArgs = Command()
   ECode = CLng(CmdArgs) 

   'ADD THE REST OF THE CODE 
End Sub

Then call it with the ECode parameter from the other program (No %f<fieldname>).
HTH Ruairi

Could your manufacturing facility benefit from real time process monitoring? Would you like your employees to be able to see up to the minute goal and actual production?
For innovative, low cost solutions check out my website.
 
Thank you for your information. I have the VB side of the code but the TrackRecord side is puzzling.
I can't seem to get the contents of the field to be placed in the VB form. In TrackRecord, the screen that you fill out has 2 fields:
1) File name for the executable
2) Parameter control string (which they say use
%f &quot;<fieldname>&quot;) so I have %f &quot;<Enterprise Code>&quot;
When I do this then click on my Executable button, I get my VB form with the following information in my Enterprise Code field: &quot;<E so it is just taking the 1st 3 literal characters instead of the actual contents.
I'm confused!
 
It sounds like TrackRecord is interpreting
%f &quot;<Enterprise Code>&quot; as a string instead of a fieldname. For one thing, most development systems don't allow spaces in field names so are you sure <Enterprise Code> is the exact fieldname in TrackRecord>? If so maybe it wants it without the quotes:
%f <Enterprise Code>
OR
%f<Enterprise Code>
If neither works you could make a test program in VB that has 1 form with this code

Private Sub Form_Load()
MsgBox Command()
End Sub

and try calling it with the enterprise code from trackrecord. It will shouw you the whole string TrackRecord is passing, which might help figure it out.
Ruairi

Could your manufacturing facility benefit from real time process monitoring? Would you like your employees to be able to see up to the minute goal and actual production?
For innovative, low cost solutions check out my website.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top