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!

parameter not supported when trying to print datareport 1

Status
Not open for further replies.

obulldog27

Programmer
Apr 26, 2004
169
US
i am using vb6 sp6.
I get the error parameter not supported when trying to print a datareport based on a query in dataenvironment.

this is the sql statement in DE.
Code:
SELECT *  FROM Comp_Chart WHERE
(CategoryName like (?));
In parameters tab I have
catname, datatype: adiunknown, host datatype: string

This is my code in the my print reports form
Code:
With DataEnvironment1
    If .rschemcatname_query.State <> 0 Then .rschemcatname_query.Close
    .chemcatname_query (report_options.Text)
    End With
    ChemCategoryReport.Refresh
    ChemCategoryReport.Show
End Sub
 
I am not sure I understood, but this is how I am doing it :

DataEnvironment1.Connection1.open
DataEnvironment1.Command1 Parameter1
dtReport.show

in your case parameter1 will be report_Option.text

If the parameter is a string I usually use as
datataype : adVarChar and HostDataType : String

Did you look in Debug the value of report_Option.text ?

 
When you run the query in the DataEnvironment, does it return the expected results if you manually type in a valid CategoryName? (i.e. is the query valid or is it a programming error when passing the parameter to the report?)

How are you telling your report what parameter to use?

I've just done a load of work on a report which has a parameter query in it so I'm just trying to get a handle on what your doing to see if I can help!

 
I am using a drop down box called report_options.Text
The drop down box is populated from a database field and then I select which text to use then click on print button which calls this code
Code:
With DataEnvironment1
    If .rschemcatname_query.State <> 0 Then .rschemcatname_query.Close
    .chemcatname_query (report_options.Text)
    End With
    ChemCategoryReport.Refresh
    ChemCategoryReport.Show
End Sub
 
It looks a little different to the way I've done it.

Here's my print button (the form has an option box to send to screen or printer) (strValue2 is the paramater name given to the command parameter which is an integer as it corresponds to an ID and OpIDVar is a global variable set from a combo box after update)

Private Sub cmdPrint_Click()
On Error GoTo Err_Print_Click
Dim msg, Response, Title, Style As String

strValue2 = OpIDVar 'part op id lookup

With OpsReport
.Orientation = rptOrientPortrait 'set report to landscape
End With

With DataEnvironment1
.FlowGroup strValue2
End With

If DataEnvironment1.rsFlowGroup.RecordCount = 0 Then 'no records returned
msg = "There were no records matched!"
Style = vbInformation + vbOKOnly
Title = "Print..."
Response = MsgBox(msg, Style, Title)
Unload DataEnvironment1
DataEnvironment1.rsFlowGroup.Close
Unload Me
Unload OpsReport
Exit Sub
End If

If optScreen = True Then 'if the user selects screen output
OpsReport.Show
End If

If optPrinter = True Then 'if the user selects printer output
With CD1
.CancelError = True
.ShowPrinter
.FileName = OpsReport.PrintReport
.CancelError = False
End With
End If

Unload Me
Unload DataEnvironment1
DataEnvironment1.rsFlowGroup.Close
etc.


My SQL command:

SELECT blah blah FROM Products, Flowline, OpDetail, Operations, MOST,
Parts
WHERE blah blah AND (Operations.OpID = ?)

Might be a little long winded but you get the gist. Hope that is of some use?

Andrew
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top