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

Reports off VB6 Form

Status
Not open for further replies.

netusepk

IS-IT--Management
Feb 28, 2001
17
0
0
US
Hi,
I need some help working with VB6 and CR8, I have designed a query with my select statement with a parameter to be passed from VB form, so as to print a report. Also I have couple of txt boxes which are not stored in the d/b which the user inputs on the form has also to be printed on the report. Can any one suggest as to how to go around working with this, any sample code will be of great help too.
Thanks
Jack
 
You can easily pass the Selection Criteria as well as the values of your text boxes from VB Form during the declaration of your report.

Private Sub cmdPrint_Click()
Dim strSelectCriteria As String
Dim indx As Integer
On Error GoTo BadPrinting
' parText1 and parText2 are declared on your CR as parameters
crptMyReport.ParameterFields(0) = "parText1;" & txtText1
& ";True"
crptMyReport.ParameterFields(1) = "parText2;" & txtText2
& ";True"

strSelectCriteria = &quot;{<TableName>.<FieldName>} = '&quot; & <variables> & &quot;'&quot;

crptMyReport.ReplaceSelectionFormula (strSelectCriteria)
crptMyReport.Action = 1
Exit Sub

BadPrinting:
indx = MsgBox(Err.Description, _
vbInformation + vbOKOnly)
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top