Retrieving query records on datareport

Reply

Join Date: Dec 2008
Posts: 287
Reputation: firoz.raj is an unknown quantity at this point 
Solved Threads: 1
firoz.raj firoz.raj is offline Offline
Posting Whiz in Training

Retrieving query records on datareport

 
0
  #1
Jan 3rd, 2009
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
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 161
Reputation: ryan311 has a little shameless behaviour in the past 
Solved Threads: 1
ryan311 ryan311 is offline Offline
Junior Poster

Re: Retrieving query records on datareport

 
0
  #2
Jan 3rd, 2009
hi did you input an riptextbox in your data report?

regards
Ryan Riel
Reply With Quote Quick reply to this message  
Join Date: Dec 2008
Posts: 287
Reputation: firoz.raj is an unknown quantity at this point 
Solved Threads: 1
firoz.raj firoz.raj is offline Offline
Posting Whiz in Training

Re: Retrieving query records on datareport

 
0
  #3
Jan 3rd, 2009
Originally Posted by ryan311 View Post
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
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 161
Reputation: ryan311 has a little shameless behaviour in the past 
Solved Threads: 1
ryan311 ryan311 is offline Offline
Junior Poster

Re: Retrieving query records on datareport

 
0
  #4
Jan 3rd, 2009
can u tell me what is the equivalent of the emp_id, dept_name, etc in the riptextbox of your datareport thanks
Reply With Quote Quick reply to this message  
Join Date: Dec 2008
Posts: 287
Reputation: firoz.raj is an unknown quantity at this point 
Solved Threads: 1
firoz.raj firoz.raj is offline Offline
Posting Whiz in Training

Re: Retrieving query records on datareport

 
0
  #5
Jan 3rd, 2009
Originally Posted by firoz.raj View Post
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
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 161
Reputation: ryan311 has a little shameless behaviour in the past 
Solved Threads: 1
ryan311 ryan311 is offline Offline
Junior Poster

Re: Retrieving query records on datareport

 
0
  #6
Jan 3rd, 2009
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
Reply With Quote Quick reply to this message  
Join Date: Dec 2008
Posts: 287
Reputation: firoz.raj is an unknown quantity at this point 
Solved Threads: 1
firoz.raj firoz.raj is offline Offline
Posting Whiz in Training

Re: Retrieving query records on datareport

 
0
  #7
Jan 3rd, 2009
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
Reply With Quote Quick reply to this message  
Join Date: Dec 2008
Posts: 287
Reputation: firoz.raj is an unknown quantity at this point 
Solved Threads: 1
firoz.raj firoz.raj is offline Offline
Posting Whiz in Training

Re: Retrieving query records on datareport

 
0
  #8
Jan 3rd, 2009
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
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 161
Reputation: ryan311 has a little shameless behaviour in the past 
Solved Threads: 1
ryan311 ryan311 is offline Offline
Junior Poster

Re: Retrieving query records on datareport

 
0
  #9
Jan 3rd, 2009
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
Reply With Quote Quick reply to this message  
Join Date: Dec 2008
Posts: 287
Reputation: firoz.raj is an unknown quantity at this point 
Solved Threads: 1
firoz.raj firoz.raj is offline Offline
Posting Whiz in Training

Re: Retrieving query records on datareport

 
0
  #10
Jan 3rd, 2009
[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
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the Visual Basic 4 / 5 / 6 Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC