DataReport - How to display expression

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • GROG
    New Member
    • Sep 2007
    • 34

    DataReport - How to display expression

    Hi all... i have a set of record to display in my data report.. and i would like to use the "Select count (*) fromm XXXX " statement to count number of record that i've chosen..
    The problem is.. How can i make it appear in my Data report..? Using command1 in property i've coded and tested using SQL Builder.. i paste the data field on to my report.. but it doesnt appear and some error message... e.g "Express 1000 is empty/.."
    Can anyone tell me how can i solve this.. Tq
  • creative1
    Contributor
    • Sep 2007
    • 274

    #2
    can u telll what you have in coded? and where it prompts you for error

    Comment

    • QVeen72
      Recognized Expert Top Contributor
      • Oct 2006
      • 1445

      #3
      Hi,

      Place a Label on the datareport and Query from the VB6 Form and pass the value as a passive text..before calling the datareport to show..:

      [code=vb]
      'Write Code To Open RecordSet RST here...
      DataReport1.Sec tions(2).Contro ls("MyLabel1"). Caption = (RST(0) & "")
      DataReport1.Ref resh
      DataReport1.Sho w
      [/code]

      The abive code assuming, there is no Group section, if u have any, change Section Index accordingly..

      Regards
      Veena

      Comment

      • GROG
        New Member
        • Sep 2007
        • 34

        #4
        hi.. i have a Dataenvironment consisting a connection, 3 command, (parent, 1st child,2nd child) my aim of my report is to get a set of record based on the two table(i.e parent (group header) and 1st child(details)) .. and it went well.. (based on ur "dynamic Report " write up..thanks again)

        so. now i have a set of record and, i want to put in my report , how many record affected when the query executed.. so.. i come up wif another command (2nd child) and from the property, i've selected the source of data from SQL Statement "Select Count (*) from XXXX" .. and i didn't relate it with the first child.. (tried to relate no joy..)

        I paste the data field (rptTextbox) on my report.. and run it.. "datafield Command1.expres s 1000 not found"

        Comment

        • GROG
          New Member
          • Sep 2007
          • 34

          #5
          veen, thanks, tried.. no joy.. still trying...

          Comment

          • QVeen72
            Recognized Expert Top Contributor
            • Oct 2006
            • 1445

            #6
            Originally posted by GROG
            veen, thanks, tried.. no joy.. still trying...
            did u open the connection and recset properly what SQL Query did u use..?

            Regards
            Veena

            Comment

            • creative1
              Contributor
              • Sep 2007
              • 274

              #7
              If you get count on form try to store it in a variable and then display it on report using code posted by Veena. It might work for you.

              Comment

              • GROG
                New Member
                • Sep 2007
                • 34

                #8
                Hi all , this is the connection and recset used...

                Conn.CursorLoca tion = adUseClient
                Conn.Connection String = DEnviroPeribadi .Connection1
                Conn.Open

                // Query// ( "Select * from XXX where name= xxx ..") <-- this is fine.. but the problem is.. to get the count of how many rows affected.. can i paste the code here? or there's other method..

                RS.Open query, Conn, adOpenForwardOn ly
                Set Peribadi_rpt.Da taSource = RS

                ... did i got the rite idea..?

                Comment

                Working...