Error in Data Report

  • (2 Pages)
  • +
  • 1
  • 2

25 Replies - 2521 Views - Last Post: 07 June 2011 - 11:33 PM Rate Topic: -----

#1 dongodu  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 44
  • Joined: 30-March 09

Error in Data Report

Posted 17 May 2011 - 07:41 AM

Private Sub ListView1_Click()

Dim cnindvprnt As New ADODB.connection
Dim rsindvprnt As New ADODB.recordset

Call connection(cnindvprnt, App.Path & "\Sales.mdb", "engman")
Call recordset(rsindvprnt, cnindvprnt, "SELECT * FROM Reser WHERE reno='" & txtReno.Text & "'")

If rsindvprnt.RecordCount = 0 Then
'MsgBox "Select Search button first.", vbExclamation, "Engcore Merchandising"
Exit Sub
End If

Set Reservation.DataSource = rsindvprnt

Reservation.Show 1

Set cnindvprnt = Nothing
Set rsindvprnt = Nothing

End Sub

Note: Not Displaying Records in Report.

Is This A Good Question/Topic? 0
  • +

Replies To: Error in Data Report

#2 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 9096
  • View blog
  • Posts: 34,161
  • Joined: 12-June 08

Re: Error in Data Report

Posted 17 May 2011 - 07:59 AM

What is the error? Which line? What is it supposed to be doing?
Was This Post Helpful? 0
  • +
  • -

#3 dongodu  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 44
  • Joined: 30-March 09

Re: Error in Data Report

Posted 17 May 2011 - 08:06 AM

View Postmodi123_1, on 17 May 2011 - 07:59 AM, said:

What is the error? Which line? What is it supposed to be doing?

Just Displaying Report not in run time with out needed information

Attached image(s)

  • Attached Image
  • Attached Image

Was This Post Helpful? 0
  • +
  • -

#4 thava  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 180
  • View blog
  • Posts: 1,606
  • Joined: 17-April 07

Re: Error in Data Report

Posted 18 May 2011 - 06:43 PM

how did you create your report? if it is based on DE
then set the datasource to DE(Data Environment)
Was This Post Helpful? 0
  • +
  • -

#5 dongodu  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 44
  • Joined: 30-March 09

Re: Error in Data Report

Posted 22 May 2011 - 01:07 AM

View Postthava, on 18 May 2011 - 06:43 PM, said:

how did you create your report? if it is based on DE
then set the datasource to DE(Data Environment)

Private Sub cmdAcchu_Click()
Dim obj, rs As ADODB.recordset, SQL As String

    Set rs = New ADODB.recordset

    

    Set rs = New ADODB.recordset
    strString = " SELECT cusname,idnumb,mobi,pron,proc,blkno,lannum,sqland,cost,comiso,addit,deduc,gtot,vali,rename" & _
                 " From reser" & _
                 " WHERE reno = '" & Combo1.Text & "' "

   
    rs.Open strString, db, adOpenStatic
'    Set rs = db.Execute(strString)
      'With reportPS
       If Not rs.EOF Then
       Set Reservation.DataSource = rs.DataSource


'-----------------------------------------------------------------------------------------------'
'Detail
Reservation.Sections("Detail").Controls("tcusname").Caption = CStr(rs!cusname)
Reservation.Sections("Detail").Controls("tidnumb").Caption = CStr(rs!idnumb)
Reservation.Sections("Detail").Controls("tmobi").Caption = CStr(rs!mobi)
Reservation.Sections("Detail").Controls("tPron").Caption = CStr(rs!ProN)
Reservation.Sections("Detail").Controls("tProc").Caption = CStr(rs!Proc)
Reservation.Sections("Detail").Controls("tBlkno").Caption = CStr(rs!Blkno)
Reservation.Sections("Detail").Controls("tLannum").Caption = CStr(rs!Lannum)
Reservation.Sections("Detail").Controls("tsqland").Caption = CStr(rs!sqland)
Reservation.Sections("Detail").Controls("tcost").Caption = CStr(rs!cost)
Reservation.Sections("Detail").Controls("tComiso").Caption = CStr(rs!comiso)
Reservation.Sections("Detail").Controls("tAddit").Caption = CStr(rs!Addit)
Reservation.Sections("Detail").Controls("tDeduc").Caption = CStr(rs!deduc)
Reservation.Sections("Detail").Controls("tGtot").Caption = CStr(rs!Gtot)
Reservation.Sections("Detail").Controls("tVali").Caption = CStr(rs!vali)
Reservation.Sections("Detail").Controls("trename").Caption = CStr(rs!rename)
Reservation.Sections("Detail").Controls("tcusname1").Caption = CStr(rs!cusname)
Reservation.Sections("Detail").Controls("tvali1").Caption = CStr(rs!vali)
'-----------------------------------------------------------------------------------------------'



Reservation.Show vbModal


End If
'End With


'For Each obj In reportPS.Sections("Details").Controls
 '   If TypeOf obj Is RptTextBox Then
  '      obj.DataMember = rs.DataMember

'End If
'Next


End Sub

Run Time Error:2147467259(80004005)
Method 'Sections' of Object 'Reservation' Failed

This post has been edited by dongodu: 22 May 2011 - 01:14 AM

Was This Post Helpful? 0
  • +
  • -

#6 thava  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 180
  • View blog
  • Posts: 1,606
  • Joined: 17-April 07

Re: Error in Data Report

Posted 22 May 2011 - 05:43 PM

just read this link throughly and the solution is
reservation.show


before you use the sections
nay be i am wrong,
still i am not sure, in which way did you create the report
did you create the report using this way? then there is no need to use sections
Was This Post Helpful? 0
  • +
  • -

#7 thava  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 180
  • View blog
  • Posts: 1,606
  • Joined: 17-April 07

Re: Error in Data Report

Posted 22 May 2011 - 06:00 PM

may be this will help you a detail to how to use a dataReport in vb6.0?
Was This Post Helpful? 0
  • +
  • -

#8 dongodu  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 44
  • Joined: 30-March 09

Re: Error in Data Report

Posted 23 May 2011 - 08:30 AM

Please check attach file for reference of Setions method.
Find file in this link , rename the file to .rar and extract and run it.
http://www.filefactory.com/file/cb7ad2b/n/pay.dmp 

Was This Post Helpful? 0
  • +
  • -

#9 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 9096
  • View blog
  • Posts: 34,161
  • Joined: 12-June 08

Re: Error in Data Report

Posted 23 May 2011 - 08:35 AM

What was that in response to?
Was This Post Helpful? 0
  • +
  • -

#10 dongodu  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 44
  • Joined: 30-March 09

Re: Error in Data Report

Posted 24 May 2011 - 12:09 AM

Run Time Error:2147467259(80004005)
Method 'Sections' of Object 'Reservation' Failed
Was This Post Helpful? 0
  • +
  • -

#11 thava  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 180
  • View blog
  • Posts: 1,606
  • Joined: 17-April 07

Re: Error in Data Report

Posted 24 May 2011 - 06:35 PM

ok what's the problem there both report are running perfectly

if you note the both reports using only labels not text boxes
hope you got it
Was This Post Helpful? 0
  • +
  • -

#12 dongodu  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 44
  • Joined: 30-March 09

Re: Error in Data Report

Posted 25 May 2011 - 01:47 AM

Getting this Error in my Code

Option Explicit
Dim db As ADODB.connection
Dim strString As String
Dim rs As ADODB.recordset
Dim cs As ADODB.connection
Dim ks As ADODB.recordset
Private Const CB_SHOWDROPDOWN           As Long = &H14F
Private Const CB_GETDROPPEDSTATE        As Long = &H157
Private Drop                    As Boolean
Private Const CB_FINDSTRING = &H14C
Private Const CB_SELECTSTRING = &H14D
Private Const CB_LIMITTEXT = &H141
Private Const CB_ERR = (-1)
Private Sub db_conn()
Set db = New ADODB.connection

db.CursorLocation = adUseClient

db.Open "PROVIDER = Microsoft.Jet.OLEDB.4.0;Data Source =" & App.Path & "\Medrar.mdb;"
End Sub
Private Sub cmdAcchu_Click()
Dim obj, rs As ADODB.recordset, SQL As String

    Set rs = New ADODB.recordset

    

    Set rs = New ADODB.recordset
    strString = " SELECT cusname,idnumb,mobi,pron,proc,blkno,lannum,sqland,cost,comiso,addit,deduc,gtot,vali,rename" & _
                 " From reser" & _
                 " WHERE reno = '" & Combo1.Text & "' "

   
    rs.Open strString, db, adOpenStatic
'    Set rs = db.Execute(strString)
      'With reportPS
       If Not rs.EOF Then
       Set Reservation.DataSource = rs.DataSource


'-----------------------------------------------------------------------------------------------'
'Detail
Reservation.Sections("Detail").Controls("lblcusname").Caption = CStr(rs!cusname)
Reservation.Sections("Detail").Controls("lblidnumber").Caption = CStr(rs!idnumb)
Reservation.Sections("Detail").Controls("lblmobile").Caption = CStr(rs!mobi)
Reservation.Sections("Detail").Controls("lblPron").Caption = CStr(rs!ProN)
Reservation.Sections("Detail").Controls("lblProc").Caption = CStr(rs!Proc)
Reservation.Sections("Detail").Controls("lblBlkno").Caption = CStr(rs!Blkno)
Reservation.Sections("Detail").Controls("lblLn").Caption = CStr(rs!Lannum)
Reservation.Sections("Detail").Controls("lblsql").Caption = CStr(rs!sqland)
Reservation.Sections("Detail").Controls("lblcost").Caption = CStr(rs!cost)
Reservation.Sections("Detail").Controls("lbCommi").Caption = CStr(rs!comiso)
Reservation.Sections("Detail").Controls("lblAdd").Caption = CStr(rs!Addit)
Reservation.Sections("Detail").Controls("lblDed").Caption = CStr(rs!deduc)
Reservation.Sections("Detail").Controls("lblGt").Caption = CStr(rs!Gtot)
Reservation.Sections("Detail").Controls("lblVali").Caption = CStr(rs!vali)
Reservation.Sections("Detail").Controls("lblrname").Caption = CStr(rs!rename)
Reservation.Sections("Detail").Controls("lblcname").Caption = CStr(rs!cusname)
Reservation.Sections("Detail").Controls("lblvali1").Caption = CStr(rs!vali)
'-----------------------------------------------------------------------------------------------'


Reservation.Refresh
Reservation.Show vbModal


End If
'End With


'For Each obj In reportPS.Sections("Details").Controls
 '   If TypeOf obj Is RptTextBox Then
  '      obj.DataMember = rs.DataMember

'End If
'Next


End Sub
Private Sub cmdbye_Click()
Unload FrmResPrnt
End Sub
Private Sub Combo1_Click()
Dim cnemployee As New ADODB.connection
Dim rsemployee As New ADODB.recordset

Call connection(cnemployee, App.Path & "\Medrar.mdb", "endromida")
Call recordset(rsemployee, cnemployee, "SELECT * FROM Reser WHERE Reno ='" & Combo1.Text & "'")

If rsemployee.RecordCount = 0 Then
MsgBox "The record you requested could not be found.", vbExclamation, "Medrar"
Exit Sub
End If

With rsemployee


End With

Set cnemployee = Nothing
Set rsemployee = Nothing
End Sub
Private Sub Combo1_KeyPress(KeyAscii As Integer)
Dim t$, rez&, l&
Combo1.SelText = ""
t$ = Combo1.Text & Chr$(KeyAscii)
rez& = SendMessage(Combo1.hwnd, CB_FINDSTRING, -1, ByVal t$)
If rez& <> CB_ERR Then
    l& = Len(t$)
    Combo1.Text = Combo1.list(rez&)
   Combo1.ListIndex = rez&
    KeyAscii = 0
    Combo1.SelStart = l&
    Combo1.SelLength = Len(Combo1.Text) - l&
End If
Dropdown
End Sub
Private Sub Combo1_LostFocus()
Dim t$, rez&
t$ = Combo1.Text
rez& = SendMessage(Combo1.hwnd, CB_FINDSTRING, -1, ByVal t$)
End Sub
Private Sub Dropdown()
   If Drop Then
      If SendMessage(Combo1.hwnd, CB_GETDROPPEDSTATE, 0, ByVal 0&) = 0 Then
         Call SendMessage(Combo1.hwnd, CB_SHOWDROPDOWN, 1&, 0&)
      End If
   End If
End Sub
Private Sub res()
Set cs = CreateObject("Adodb.connection")
cs.Provider = "Microsoft.jet.oledb.4.0"
cs.Open App.Path & "\Medrar.mdb"
Set ks = New ADODB.recordset
ks.Open "Select reno from reser", cs, adOpenKeyset, adLockOptimistic
While Not ks.EOF
    Combo1.AddItem ks.Fields("Reno")
    ks.MoveNext
Wend
ks.Close
Set ks = Nothing
Drop = True
End Sub
Private Sub Form_Load()
Call res
End Sub

Attached image(s)

  • Attached Image

Was This Post Helpful? 0
  • +
  • -

#13 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 9096
  • View blog
  • Posts: 34,161
  • Joined: 12-June 08

Re: Error in Data Report

Posted 25 May 2011 - 06:57 AM

You get that error where? This thread is very close to being locked unless you become really clear in what the problem is, what line, what it is doing, what it is not doing. You have a 149 lines of code that we can't compile or interact with in a meaningful way. If you want our help you have to be more clear and open with us.

This post has been edited by modi123_1: 25 May 2011 - 06:58 AM

Was This Post Helpful? 0
  • +
  • -

#14 dongodu  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 44
  • Joined: 30-March 09

Re: Error in Data Report

Posted 25 May 2011 - 07:48 AM

(edit modi123_1): The error is in line 13.

Private Sub cmdAcchu_Click()
Dim obj, rs As ADODB.recordset, SQL As String

    Set rs = New ADODB.recordset

    
    Set rs = New ADODB.recordset
    strString = " SELECT cusname,idnumb,mobi,pron,proc,blkno,lannum,sqland,cost,comiso,addit,deduc,gtot,vali,rename" & _
                 " From reser" & _
                 " WHERE reno = '" & Combo1.Text & "' "

   
    rs.Open strString, DB, adOpenStatic ------>[b]Error in This Line [/b]
'    Set rs = db.Execute(strString)
      'With reportPS
       If Not rs.EOF Then
       Set Reservation.DataSource = rs.DataSource


'-----------------------------------------------------------------------------------------------'
'PageHeader
Reservation.Sections("PageHeader").Controls("lblcusname").Caption = CStr(rs!cusname)
Reservation.Sections("PageHeader").Controls("lblidnumber").Caption = CStr(rs!idnumb)
Reservation.Sections("PageHeader").Controls("lblmobile").Caption = CStr(rs!mobi)
Reservation.Sections("PageHeader").Controls("lblPron").Caption = CStr(rs!pron)
Reservation.Sections("PageHeader").Controls("lblProc").Caption = CStr(rs!proc)
Reservation.Sections("PageHeader").Controls("lblBlkno").Caption = CStr(rs!blkno)
Reservation.Sections("PageHeader").Controls("lblLn").Caption = CStr(rs!lannum)
Reservation.Sections("PageHeader").Controls("lblsql").Caption = CStr(rs!sqland)
Reservation.Sections("PageHeader").Controls("lblcost").Caption = CStr(rs!cost)
Reservation.Sections("PageHeader").Controls("lbCommi").Caption = CStr(rs!comiso)
Reservation.Sections("PageHeader").Controls("lblAdd").Caption = CStr(rs!Addit)
Reservation.Sections("PageHeader").Controls("lblDed").Caption = CStr(rs!deduc)
Reservation.Sections("PageHeader").Controls("lblGt").Caption = CStr(rs!Gtot)
Reservation.Sections("PageHeader").Controls("lblVali").Caption = CStr(rs!vali)
Reservation.Sections("PageHeader").Controls("lblrname").Caption = CStr(rs!rename)
Reservation.Sections("PageHeader").Controls("lblcname").Caption = CStr(rs!cusname)
Reservation.Sections("PageHeader").Controls("lblvali1").Caption = CStr(rs!vali)
'-----------------------------------------------------------------------------------------------'


Reservation.Refresh
Reservation.Show vbModal


End If
'End With


'For Each obj In reportPS.Sections("PageHeaders").Controls
 '   If TypeOf obj Is RptTextBox Then
  '      obj.DataMember = rs.DataMember

'End If
'Next


End Sub



This post has been edited by modi123_1: 25 May 2011 - 07:56 AM

Was This Post Helpful? 0
  • +
  • -

#15 thava  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 180
  • View blog
  • Posts: 1,606
  • Joined: 17-April 07

Re: Error in Data Report

Posted 25 May 2011 - 06:20 PM

that is because you did not open a connection to the database and set it to the recordset rs
create a new object for the adodb.connection and set it to the rs object before open it
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2