Retrieving query records on datareport

Reply

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
  #11
Jan 3rd, 2009
Private Sub Command4_Click()
Set rs = New adodb.Recordset
rs.Open " select * from MR query", con, adOpenKeyset, adLockPessimistic
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.Show
End If
End If
End Sub


try to erase this

DataReport2.Orientation = rptOrientLandscape

and change this adOpenDynamic, adLockOptimistic
to this adOpenKeyset, adLockPessimistic

regards
Ryan Riel
Reply With Quote Quick reply to this message  
Join Date: Dec 2008
Posts: 292
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
  #12
Jan 3rd, 2009
now it is working but requirement is that when user click on print
inputbox should come to demand MR NO if it match with mr_no of database then corresponding record should come in a report
kindly help me
Private Sub Command4_Click()
Set rs = New adodb.Recordset
rs.Open " select * from MR query", con, adOpenDynamic, adLockOptimistic
If Not rs.EOF Then
With DataReport2.Sections("section1").Controls
.Item("text1").DataField = rs.Fields("dept_name").Name
.Item("text2").DataField = rs.Fields("job_no").Name
End With
Set DataReport2.DataSource = rs
DataReport2.Orientation = rptOrientLandscape
DataReport2.Show
End If
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
  #13
Jan 3rd, 2009
try to put a where in rs.open select * from mr query where mr no = mr_no

regards
Ryan Riel
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
  #14
Jan 3rd, 2009
please mark it solved, if the thread is solved thanks
Reply With Quote Quick reply to this message  
Join Date: Dec 2008
Posts: 292
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
  #15
Jan 3rd, 2009
i have tried but it is not working kindly let me know
Private Sub Command4_Click()
Dim mr As Integer
mr = InputBox("enter a mr no")
Set rs = New adodb.Recordset
rs.Open " select * from MR query where mr = mr_no", con, adOpenDynamic, adLockOptimistic
If Not rs.EOF Then
With DataReport2.Sections("section1").Controls
.Item("text1").DataField = rs.Fields("dept_name").Name
.Item("text2").DataField = rs.Fields("job_no").Name
End With
Set DataReport2.DataSource = rs
DataReport2.Orientation = rptOrientLandscape
DataReport2.Show
End If
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
  #16
Jan 3rd, 2009
Dim mr As Integer
mr = InputBox("enter a mr no:", "Find", "")
Set rs = New adodb.Recordset
rs.CursorLocation = adUseClient
rs.Open " select * from MR query where mr_no = mr", con, adOpenDynamic, adLockOptimistic
If Not rs.EOF Then
With DataReport2.Sections("section1").Controls
.Item("text1").DataField = rs.Fields("dept_name").Name
.Item("text2").DataField = rs.Fields("job_no").Name
End With
Set DataReport2.DataSource = rs
DataReport2.Orientation = rptOrientLandscape
DataReport2.Show
End If
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