Ok, I have tried the Shell command... it would probably work for another program, but not the report writer I am using (see
http://reportman.sourceforge.net/)
They have a module for VB and sample code to call the module / report program, pasted below, that i have tried, but Kbasic does not like it (besides, I want to be able to compile for both LInux and Windows).... (and a way to call it in C, but I don't know C, and am unsure that would work from kbasic???)
Would anyone know how to make this work in kbasic? In both Linux / Windows, or at least a windows and a linux version?
rpreportman.bas module code:
Attribute VB_Name = "reportmanapi"
Public Declare Function rp_new Lib "Reportman.ocx" As Long
Public Declare Function rp_open Lib "Reportman.ocx" (ByVal filename As String) As Long
Public Declare Function rp_close Lib "Reportman.ocx" (ByVal hreport As Long) As Long
Public Declare Function rp_execute Lib "Reportman.ocx" (ByVal hreport As Long, ByVal outputfilename As String, ByVal Metafile As Long, ByVal Compressed As Long) As Long
Public Declare Function rp_executeremote_report Lib "Reportman.ocx" (ByVal hreport As Long, ByVal hostname As String, ByVal port As Long, ByVal user As String,ByVal password As String,ByVal aliasname As String,ByVal reportname As String,ByVal outputfilename As String,ByVal metafile As Long,ByVal Compressed As Long) As Long
Public Declare Function rp_executeremote Lib "Reportman.ocx" (ByVal hreport As Long, ByVal hostname As String, ByVal port As Long, ByVal user As String,ByVal password As String,ByVal aliasname As String,ByVal reportname As String,ByVal outputfilename As String,ByVal metafile As Long,ByVal Compressed As Long) As Long
Public Declare Function rp_getremoteparams Lib "Reportman.ocx" (ByVal hreport As Long, ByVal hostname As String, ByVal port As Long, ByVal user As String,ByVal password As String,ByVal aliasname As String,ByVal reportname As String) As Long
Public Declare Function rp_lasterror Lib "Reportman.ocx" () As String
Public Declare Function rp_preview Lib "Reportman.ocx" (ByVal hreport As Long, ByVal title As String) As Long
Public Declare Function rp_print Lib "Reportman.ocx" (ByVal hreport As Long, ByVal title As String, ByVal ShowProgress As Long, ByVal ShowPrintDialog As Long) As Long
Public Declare Function rp_setparamvalue Lib "Reportman.ocx" (ByVal hreport As Long, ByVal paramname As String, ByVal paramtype As Long, ByVal paramvalue As Long) As Long
Public Declare Function rp_setparamvaluevar Lib "Reportman.ocx" (ByVal hreport As Long, ByVal paramname As String, ByVal paramvalue As Variant) As Long
Public Declare Function rp_getparamcount Lib "Reportman.ocx" (ByVal hreport As Long, ByRef paramcount As Long) As Long
Public Declare Function rp_getparamname Lib "Reportman.ocx" (ByVal hreport As Long, ByVal index as Long, ByVal abuffer As String) As Long
Public Declare Function rp_setadoconnectionstring Lib "Reportman.ocx" (ByVal hreport As Long, ByVal conname As String, ByVal constring As String) As Long
Public Declare Function rp_previewremote Lib "Reportman.ocx" (ByVal hostname As String, ByVal port As Long, ByVal user As String,ByVal password As String,ByVal aliasname As String,ByVal reportname As String,ByVal title As String) As Long
Public Declare Function rp_previewremote_report Lib "Reportman.ocx" (ByVal hreport As Long,ByVal hostname As String, ByVal port As Long, ByVal user As String,ByVal password As String,ByVal aliasname As String,ByVal reportname As String,ByVal title As String) As Long
Public Declare Function rp_printremote Lib "Reportman.ocx" (ByVal hostname As String, ByVal port As Long, ByVal user As String,ByVal password As String,ByVal aliasname As String,ByVal reportname As String,ByVal title As String) As Long
Public Declare Function rp_printremote_report Lib "Reportman.ocx" (ByVal hreport As Long,ByVal hostname As String, ByVal port As Long, ByVal user As String,ByVal password As String,ByVal aliasname As String,ByVal reportname As String,ByVal title As String) As Long
and the code to call it from the VB (kbasic) program:
Dim ares As Long
Dim Avar As Variant
rhan = rp_open("samplevb.rep")
If rhan = 0 Then
Text1.Text = rp_lasterror
Else
Avar = "TESTING PARAM"
ares = rp_setparamvaluevar(rhan, "PARAMETER1", Avar)
If ares = 0 Then
Text1.Text = rp_lasterror
Else
ares = rp_preview(rhan, "Hello from VB")
End If
rp_close (rhan)
End If