Consulting

Results 1 to 5 of 5

Thread: Object required error

  1. #1
    VBAX Regular
    Joined
    Dec 2007
    Posts
    78
    Location

    Object required error

    If Not lowest_score.Comment.Text Is Nothing Then
    If lowest_score.Comment.Text evaluates to "1.13" in the watch window, then why do I get an "Object required" error when I run the line above?

  2. #2
    VBAX Contributor
    Joined
    Jan 2007
    Posts
    146
    Location
    i believe "is nothing" is associated with an object, but your .text is just a string. it would be better to use isnull()

  3. #3
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [vba]

    Dim cmtValue As String
    On Error Resume Next
    cmtValue = lowest_score.Comment.Text
    On Error GoTo 0
    If cmtValue <> "" Then

    '...
    End If
    [/vba]
    Last edited by Bob Phillips; 01-26-2008 at 03:13 AM.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  4. #4
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,059
    Location
    Quote Originally Posted by xld
    [cba]

    Dim cmtValue As String
    On Error Resume Next
    cmtValue = lowest_score.Comment.Text
    On Error GoTo 0
    If cmtValue <> "" Then

    '...
    End If
    [/vba]
    [cba] ....must be a British thing...
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

  5. #5
    VBAX Tutor
    Joined
    Dec 2006
    Posts
    220
    Location
    Quote Originally Posted by Aussiebear
    [cba] ....must be a British thing...
    ROFL
    "Intellectual passion occurs at the intersection of fact and implication."

    SGB

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •