|
-
Nov 19th, 2007, 12:43 AM
#1
Thread Starter
Addicted Member
[RESOLVED] Error in datareport
Hi friends ,
I am getting following error in datareport using dataenvironment
"failed getting rowset(s) from current datasource" .Please help.
My code is
Code:
Private Sub cmdprint_Click()
Dim chq As String
chq= "cheque"
Dim sr As String
sr = "select * from " & chq& " where cheque_no= '" & Text1.Text & "' "
'DataEnvironment1.Connection1.Close
DataEnvironment1.Connection1 = "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=" & App.Path & "\cheque.mdb"
DataEnvironment1.Connection1.Open
DataEnvironment1.Commands.Item(1).CommandType = adCmdText
DataEnvironment1.Commands.Item(1).CommandText = "select * from " & chq & " where cheque_no= " & Text1.Text & " "
'DataEnvironment1.Command1 = Str(DataEnvironment1.Commands.Item(1).CommandText)
Debug.Print DataEnvironment1.Commands.Item(1).CommandText
If DataEnvironment1.Connection1.State > 0 Then DataEnvironment1.Connection1.Close
DataEnvironment1.Connection1.Open
DataEnvironment1.Command1
Set DataReport1.DataSource = DataEnvironment1
Debug.Print DataReport1.DataMember
DataReport1.DataMember = sr
Debug.Print DataReport1.DataMember
DataReport1.LeftMargin = 1200
DataReport1.TopMargin = 1000
DataReport1.BottomMargin = 1000
DataReport1.Show
End Sub
-
Nov 19th, 2007, 01:38 AM
#2
Re: Error in datareport
if "sr" is the name of the DE command then try this
datareport1.datamember = "sr"
-
Nov 19th, 2007, 01:57 AM
#3
Thread Starter
Addicted Member
Re: Error in datareport
I changed to ser.but still same error comes
-
Nov 19th, 2007, 08:56 AM
#4
-
Nov 19th, 2007, 12:34 PM
#5
Re: Error in datareport
I don't understand what ser is either.
I also don't understand why your using a DE, you can use an ADO recordset. Just do this
Code:
dim rs as New ADODB.Recordset
rs.open "select * from " & chq& " where cheque_no= '" & Text1.Text & "' ", yourconnection
Set Datareport1.datasource = rs
Datareport1.datamember = rs.Datamember
Datareport1.Show vbModal
-
Nov 20th, 2007, 07:07 AM
#6
Thread Starter
Addicted Member
Re: [RESOLVED] Error in datareport
Thanks a lot.It is working fine.
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
|