More Visual Basic Answers
Question Library
Ask a question about Visual Basic
Volunteer
Experts of the Month
Expert Login
Awards
About Us
Tell friends
Link to Us
Disclaimer
|
| |
|
|
| |
| | | |
About Ravindra
Expertise visual basic application programming from design to access information, sql, engineering and commercial applications. access databases, excel.(VB6)
basic questions in vb 2008.
Optional:
1)a large number of people want me to do work which takes some time and effort. can do projects in vb 2008. Pl.note that i would like to be paid for such work.
2) if you want me to spend quality time and do special work, i expect to be paid a reasonable price for my time.
3) if you are pleased with my reply you could consider a donation of 1$.
4) you can visit my website http://ravindra.coolpage.biz
Experience
Education/Credentials engineering, management degrees.
Past/Present Clients project work for a Norway company,USA company and a Canadian company completed. Freelance Project work and Teaching. helping programmers with their work
teaching vb
| | |
| |
You are here: Experts > Computing/Technology > Basic > Visual Basic > Printing Data Report
Expert: Ravindra - 10/31/2009
Question Good Day. I am a beginner in vb 6.0.My question is how to print a data report as a result of search button? I used option and frame for my search, now i want to print whatever the result of my search button as a data report, but my report is empty. thanks.
here are some of my code:
Private Sub Srch_Click()
If Frame2.Enabled = True Then
Adodc1.RecordSource = "SELECT * FROM mmc WHERE Student_ID Like '" & txtidnum.Text & "'"
Adodc1.Refresh
Adodc1.Caption = Adodc1.RecordSource
end Sub
Private Sub cmdReport_Click()
Set rs = conn.Execute("SELECT * FROM CollegeStudent")
Set DataReport1.DataSource = rs
DataReport1.Show vbModal
Answer your method has problems: here's a typical code:
connect dataenvironment to the table connect it to your database
add command
command1 properties
select * from TableName where ID=?
'change the field names and tablenames here
drag the command to the datareport
have a button on form and add code:
Private Sub Command1_Click()
With DataEnvironment1
If .rsCommand1.State = adStateOpen Then
.rsCommand1.Close
End If
.Command1 val(textIdNo)
'match the formats of date found in your table and here
If .rsCommand1.RecordCount > 0 Then
Set DataReport1.DataSource = DataEnvironment1
DataReport1.Show
Else
MsgBox "No Records found"
End If
End With
End Sub
Ravindra M.G.
Ask a Question
|
|