|
-
Aug 10th, 2005, 11:45 PM
#1
Thread Starter
Lively Member
Displaying selected records in data reports
Hi all
I am using data reports with out data environment.Here i am displaying the report using a table. But i am not able to display the selected records.
For e.g. A report displays Student id, Name and result.
But i want to display the results of only the passed students.can anyone please tell me How i do this?
I have used the following code:
VB Code:
Private Sub DataReport_Initialize()
'Procedure to connect database
connection
strSQL = "SELECT * from tblstudent"
Set rs = New ADODB.Recordset
rs.Open strSQL, cn, adOpenDynamic, adLockOptimistic
Set DataReport1.DataSource = rs
End Sub
-
Aug 10th, 2005, 11:50 PM
#2
Re: Displaying selected records in data reports
You would have to modify your code below...
VB Code:
"SELECT * from tblstudent"
Provide it a WHERE clause like...
VB Code:
"SELECT * from tblstudent WHERE Passed = True"
-
Aug 10th, 2005, 11:54 PM
#3
Junior Member
Re: Displaying selected records in data reports
Did you use the refresh method? Try to insert refresh before opening the report.
-
Aug 11th, 2005, 12:07 AM
#4
Thread Starter
Lively Member
Re: Displaying selected records in data reports
Thanks for the reply.
It is working fine. I have to design one more report, where i have to display the results of all the students and highlight the records with the results fail in red.
I tried to do this using an if statement
VB Code:
If Datareport1.Sections("Section2").Controls("Text1").Text = "Fail" then
text1.forecolor=vbred
end if
But it is giving an error Text1 not found.
Please tell me how to do this?
-
Aug 11th, 2005, 12:09 AM
#5
Re: Displaying selected records in data reports
Shouldnt it be something like this?
VB Code:
If Datareport1.Sections("Section2").Controls("Text1").Text = "Fail" then
Datareport1.Sections("Section2").Controls("Text1").Text.forecolor=vbred
end if
-
Aug 11th, 2005, 12:16 AM
#6
Thread Starter
Lively Member
Re: Displaying selected records in data reports
Thanks for the reply.
I tried with this code.But it is still giving me the same error.
-
Aug 11th, 2005, 12:21 AM
#7
Re: Displaying selected records in data reports
I'm just guessing right now but this could be it...
VB Code:
Datareport1.Sections("Section2").Controls("Text1").Text.[B]font.[/B]forecolor=vbred
-
Aug 11th, 2005, 12:53 AM
#8
Thread Starter
Lively Member
Re: Displaying selected records in data reports
Thanks for the reply.
It is still giving me the same error. we can use the same code for lables to change their caption,Font fore color etc.
But the same not working for a text box.I don't know why conditional statement is not working in the report.
Can I assign two tables for the same report using data source method?
Last edited by c_hillary2000; Aug 11th, 2005 at 01:11 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|