| | |
Retrieving query records on datareport
![]() |
•
•
Join Date: Jul 2008
Posts: 161
Reputation:
Solved Threads: 1
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
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
•
•
Join Date: Dec 2008
Posts: 292
Reputation:
Solved Threads: 1
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
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
•
•
Join Date: Dec 2008
Posts: 292
Reputation:
Solved Threads: 1
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
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
•
•
Join Date: Jul 2008
Posts: 161
Reputation:
Solved Threads: 1
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
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
![]() |
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: Adding a search function
- Next Thread: auto e-mail
| Thread Tools | Search this Thread |
* 6 429 2007 access activex add age application basic beginner birth bmp calculator cd cells.find click client code college component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report save search sendbyte sites sort sql sql2008 sqlserver subroutine tags textbox time urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows





