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

Crystal Report generated by text in text boxes on vb6 Form

Status
Not open for further replies.

VBVines

MIS
Jun 11, 1999
98
US
I have a need to generate a monthly report based on text entered in text boxes on a vb6 form. Right now I am just trying to talor a recordset but eventually I want to enter a date range in two text boxes. This is my code. One text box, one command button, a data control and a Crystal report control. Thanks for any kind of a path forward.

Private Sub Command1_Click()

CrystalReport1.Action = 1

Set ddb = Data1.Database
Set drs = Data1.Recordset

Data1.DatabaseName = "C:\Databases\course_data.mdb"
Data1.RecordsetType = 1 'table type Recordset

Data1.RecordSource = "SELECT * FROM Course " _
& " WHERE CourseID = '" & Text1.Text & "'"
Data1.Refresh

CrystalReport1.Action = 1

End Sub

Private Sub Form_Load()

Screen.MousePointer = 11
Form1.Move Screen.Height \ 2 - Form1.Height \ 2, Screen.Width \ 2 - Form1.Width \ 2
Load Form1
Form1.Show
Screen.MousePointer = 0


End Sub
aspvbwannab
 
One thing you have to be careful of when passing recordsets is that the report has to be created using the active data driver or converted to use this driver. Otherwise it won't accept a recordset from VB. Ken Hamady
Crystal Reports Training and a
Quick Reference Guide to VB/Crystal
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top