compile error invalid use of property

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • PoojaJyoti
    New Member
    • Mar 2007
    • 4

    compile error invalid use of property

    Hi,
    When I write code
    txtFirstName.te xt=rstKrish("Fi rstName")
    compiler highlighted .text and error describes method or data member not found.
    Please help
  • Killer42
    Recognized Expert Expert
    • Oct 2006
    • 8429

    #2
    Originally posted by PoojaJyoti
    When I write code
    txtFirstName.te xt=rstKrish("Fi rstName")
    compiler highlighted .text and error describes method or data member not found.
    Please give us some context. for example...
    • What version of VB is this?
    • What is txtFirstName?

    Assuming it's a textbox, is this code within the same form? If not, you probably need to use a syntax something like YourFormName.txtFirstName.T ext to access this value.

    Comment

    • willakawill
      Top Contributor
      • Oct 2006
      • 1646

      #3
      You should continue your questions on the same thread rather than starting a new one each time your code doesn't work. I have closed the original thread and this is a link to it

      Comment

      • PoojaJyoti
        New Member
        • Mar 2007
        • 4

        #4
        Originally posted by Killer42
        Please give us some context. for example...
        • What version of VB is this?
        • What is txtFirstName?

        Assuming it's a textbox, is this code within the same form? If not, you probably need to use a syntax something like YourFormName.txtFirstName.T ext to access this value.
        I have used Visual Basic 6.0 and txtFirstName is textbox

        Comment

        • vijaydiwakar
          Contributor
          • Feb 2007
          • 579

          #5
          Originally posted by PoojaJyoti
          Hi,
          When I write code
          txtFirstName.te xt=rstKrish("Fi rstName")
          compiler highlighted .text and error describes method or data member not found.
          Please help
          check first the column name of recordset is spelled correct then check it doen't contain any null value to avoid this use this code
          txt.text=Rs0("F irstName") &""
          try it

          Comment

          • Killer42
            Recognized Expert Expert
            • Oct 2006
            • 8429

            #6
            Originally posted by vijaydiwakar
            check first the column name of recordset is spelled correct then check it doen't contain any null value to avoid this use this code
            txt.text=Rs0("F irstName") &""
            Or, as a first step in debugging, comment out the existing line and replace it with...
            Code:
            txtFirstName.text = "A"
            This will determine for certain whether the problem lies with the database field or the textbox. My money would be on the latter.

            If the textbox is the problem, then chances are it is simply out of scope. For example, your code might be on a different form, or in a code module rather than a form. If that's the case, then you need to identify the form that it lives on - see my earlier post for details.

            On the other hand, are you certain it's a textbox? And not, for example, a label?

            Comment

            Working...