943,733 Members | Top Members by Rank

Ad:
You are currently viewing page 1 of this multi-page discussion thread
Jan 3rd, 2009
0

Retrieving query records on datareport

Expand Post »
SIR ,

I WANT IF USER CLICK ON PRINT BUTTON ALL THE RECORDS SHOULD
COME IN A REPORT FROM MR QUERY Product_tabletest.zip BUT RECORDS ARE NOT SHOWING ON DATA REPORT.

I HAVE WRITTEN A CODE IN PRINT_CLICK

Private Sub Command4_Click()
Set rs = New adodb.Recordset
rs.Open " select * from MR query", con, adOpenDynamic, adLockOptimistic
Set DataReport2.DataSource = rs
DataReport2.Orientation = rptOrientLandscape
DataReport2.Show
End Sub
Reputation Points: 7
Solved Threads: 1
Posting Pro in Training
firoz.raj is offline Offline
415 posts
since Dec 2008
Jan 3rd, 2009
0

Re: Retrieving query records on datareport

hi did you input an riptextbox in your data report?

regards
Ryan Riel
Reputation Points: 3
Solved Threads: 5
Posting Whiz in Training
ryan311 is offline Offline
254 posts
since Jul 2008
Jan 3rd, 2009
0

Re: Retrieving query records on datareport

Click to Expand / Collapse  Quote originally posted by ryan311 ...
hi did you input an riptextbox in your data report?

regards
Ryan Riel
yes i have taken a textbox i am getting error datafield is empty
and datasource not found
Reputation Points: 7
Solved Threads: 1
Posting Pro in Training
firoz.raj is offline Offline
415 posts
since Dec 2008
Jan 3rd, 2009
0

Re: Retrieving query records on datareport

can u tell me what is the equivalent of the emp_id, dept_name, etc in the riptextbox of your datareport thanks
Reputation Points: 3
Solved Threads: 5
Posting Whiz in Training
ryan311 is offline Offline
254 posts
since Jul 2008
Jan 3rd, 2009
0

Re: Retrieving query records on datareport

Click to Expand / Collapse  Quote originally posted by firoz.raj ...
yes i have taken a textbox i am getting error datafield is empty
and datasource not found
i don't know MR table is not comming in object name in command2
properties dialog box
Reputation Points: 7
Solved Threads: 1
Posting Pro in Training
firoz.raj is offline Offline
415 posts
since Dec 2008
Jan 3rd, 2009
0

Re: Retrieving query records on datareport

yes because you did not add an item to your data report, you should add an item in your data report like this way:

With datareport2.Sections("Section1").Controls
.Item("Text1").DataField = rs.Fields("Emp_file").Name
end with
set datareport2.datasource = rs

regards
Ryan
Reputation Points: 3
Solved Threads: 5
Posting Whiz in Training
ryan311 is offline Offline
254 posts
since Jul 2008
Jan 3rd, 2009
0

Re: Retrieving query records on datareport

in which event should i write this code when i go in code window of data report
i got only
activate
deactivate
error
initialize event in which event should i write this code
Reputation Points: 7
Solved Threads: 1
Posting Pro in Training
firoz.raj is offline Offline
415 posts
since Dec 2008
Jan 3rd, 2009
0

Re: Retrieving query records on datareport

where should i write
i have written in print_click but it is not working
Private Sub Command4_Click()
Set rs = New adodb.Recordset
rs.Open " select * from MR query", con, adOpenDynamic, adLockOptimistic
Set DataReport2.DataSource = rs
DataReport2.Orientation = rptOrientLandscape
'With DataReport2.Sections("Section1").Controls
'.Item("Text1").DataField = rs.Fields("Emp_file").Name
'End With
DataReport2.Sections("section1").Controls
Set DataReport2.DataSource = rs
DataReport2.Show
End Sub
Reputation Points: 7
Solved Threads: 1
Posting Pro in Training
firoz.raj is offline Offline
415 posts
since Dec 2008
Jan 3rd, 2009
0

Re: Retrieving query records on datareport

Private Sub Command4_Click()
Set rs = New adodb.Recordset
rs.Open " select * from MR query", con, adOpenDynamic, adLockOptimistic
if rs.recordcount > 0 then
if not rs.eof then
with datareport2.sections("section1").controls
.item("text1").datafield = rs.fields("emp_file").name
'etc.
end with
end if
set datareport2.datasource = rs
datareport2.show
end if

end sub

regards
Ryan Riel
Last edited by ryan311; Jan 3rd, 2009 at 9:40 am. Reason: i forgot
Reputation Points: 3
Solved Threads: 5
Posting Whiz in Training
ryan311 is offline Offline
254 posts
since Jul 2008
Jan 3rd, 2009
0

Re: Retrieving query records on datareport

[QUOTE=ryan311;769960]Private Sub Command4_Click()
system hangs i don't know why
Private Sub Command4_Click()
Set rs = New adodb.Recordset
rs.Open " select * from MR query", con, adOpenDynamic, adLockOptimistic
If rs.RecordCount > 0 Then
If Not rs.EOF Then
With DataReport2.Sections("section1").Controls
.Item("text1").DataField = rs.Fields("dept_name").Name
End With
Set DataReport2.DataSource = rs
DataReport2.Orientation = rptOrientLandscape
DataReport2.Show
End If
End If
End Sub
Reputation Points: 7
Solved Threads: 1
Posting Pro in Training
firoz.raj is offline Offline
415 posts
since Dec 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Adding a search function
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: auto e-mail





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC