Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. how to pass text value from form to data report???[urgent]

how to pass text value from form to data report???[urgent]

Scheduled Pinned Locked Moved Visual Basic
helptutorialquestion
7 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    campbells
    wrote on last edited by
    #1

    i want to show the text value from form in the data report but i have try many ways it just not working... or data memeber not found. in my data report code i put: label2.caption= module1.textfromform textfromform which is a global varible i set in my module1. but having error :"Object required". i try to set the code in form. which is : dareport1.label12.caption=text1.text but Error:data memeber is not found Hope someone can save me~~~

    D 1 Reply Last reply
    0
    • C campbells

      i want to show the text value from form in the data report but i have try many ways it just not working... or data memeber not found. in my data report code i put: label2.caption= module1.textfromform textfromform which is a global varible i set in my module1. but having error :"Object required". i try to set the code in form. which is : dareport1.label12.caption=text1.text but Error:data memeber is not found Hope someone can save me~~~

      D Offline
      D Offline
      Dave Sexton
      wrote on last edited by
      #2

      Try declaring your form with the data outside of any sub routines as Public frm1 as Form1(or whatever it is that your form is called) & then modify

      campbells wrote:

      dareport1.label12.caption=text1.text

      to dareport1.label12.caption = frm1.text1.text

      C 1 Reply Last reply
      0
      • D Dave Sexton

        Try declaring your form with the data outside of any sub routines as Public frm1 as Form1(or whatever it is that your form is called) & then modify

        campbells wrote:

        dareport1.label12.caption=text1.text

        to dareport1.label12.caption = frm1.text1.text

        C Offline
        C Offline
        campbells
        wrote on last edited by
        #3

        actually my text1.text= stringtext -- which is a global variable~

        D 1 Reply Last reply
        0
        • C campbells

          actually my text1.text= stringtext -- which is a global variable~

          D Offline
          D Offline
          Dave Sexton
          wrote on last edited by
          #4

          Global variables should be avoided. Nevertheless, in your module declare your string variable with either Public or Friend access modifier (Friend if it's withing the same assembly). Then try dareport1.label12.caption = _modulename.variablename_

          C 1 Reply Last reply
          0
          • D Dave Sexton

            Global variables should be avoided. Nevertheless, in your module declare your string variable with either Public or Friend access modifier (Friend if it's withing the same assembly). Then try dareport1.label12.caption = _modulename.variablename_

            C Offline
            C Offline
            campbells
            wrote on last edited by
            #5

            i'm using vb6, i think dont have friend this command. It is not working when i put this command dareport1.label12.caption = modulename.variablename it said Method or data memeber not found. I try to check enter the datareport name first then i found that it only link to report properties, can found those label or text in m report...

            D 1 Reply Last reply
            0
            • C campbells

              i'm using vb6, i think dont have friend this command. It is not working when i put this command dareport1.label12.caption = modulename.variablename it said Method or data memeber not found. I try to check enter the datareport name first then i found that it only link to report properties, can found those label or text in m report...

              D Offline
              D Offline
              Dave Sexton
              wrote on last edited by
              #6

              I think you misunderstood my code snippet - _modulename.variablename_ is supposed to represent the public variable in the module you are using to populate your data report, I put it in italics for as an example for you as I don't know what you've named the module or the variable. The point I'm trying to make is, from what I understand, you have a module that populates the data report

              Public Module basDataReport

              Public strCaption As String '<--- global string variable

              Function GetReportCaption()As String '<--- your method that gets report caption
              ''''''
              ''' <--- put your processing here e.g.
              'strCaption = blah blah blah
              '''''''
              Return strCaption '<--- string variable with data
              End Sub
              End Module

              Inside whichever method call it is that you're using to set the caption you could call MyReport.Caption = basDataReport.strCaption to get the global variable after it's already been assigned OR if you're using a function like in the example above you could call on the function by name e.g. MyReport.Caption = GetReportCaption(). See what I mean?

              C 1 Reply Last reply
              0
              • D Dave Sexton

                I think you misunderstood my code snippet - _modulename.variablename_ is supposed to represent the public variable in the module you are using to populate your data report, I put it in italics for as an example for you as I don't know what you've named the module or the variable. The point I'm trying to make is, from what I understand, you have a module that populates the data report

                Public Module basDataReport

                Public strCaption As String '<--- global string variable

                Function GetReportCaption()As String '<--- your method that gets report caption
                ''''''
                ''' <--- put your processing here e.g.
                'strCaption = blah blah blah
                '''''''
                Return strCaption '<--- string variable with data
                End Sub
                End Module

                Inside whichever method call it is that you're using to set the caption you could call MyReport.Caption = basDataReport.strCaption to get the global variable after it's already been assigned OR if you're using a function like in the example above you could call on the function by name e.g. MyReport.Caption = GetReportCaption(). See what I mean?

                C Offline
                C Offline
                campbells
                wrote on last edited by
                #7

                is ok nvm , i solve my problem with this With Vdetail .Sections("reportheader").Controls.Item("datefrom").Caption = strFromWhen .Sections("reportheader").Controls.Item("dateto").Caption = strToWhen End With

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups