Results 1 to 6 of 6

Thread: RESOLVED Empty, Null, ??? STRING

  1. #1

    Thread Starter
    Frenzied Member swatty's Avatar
    Join Date
    Aug 2002
    Location
    somewhere on earth
    Posts
    1,478

    RESOLVED Empty, Null, ??? STRING

    Hi all,

    I am building classes to add and delete objects in the database.

    In my classes i've made a property for each field in the table.

    For the text fields i've used strings with the exact size of them.

    Now when i want to check on a string if it is empty this won't give me the right answer.

    Because my string is declared as String * 3, it is filled with 3 ???

    How can I check something was inserted in the property of the string ??
    This is how i try to check on it but all evaluations return false.
    VB Code:
    1. If IsNull(Me.journal) Or Me.journal = vbNullString Then
    2.       ival = 1
    3.       msg = msg & "No journal given." & vbCrLf
    4.    Else
    5.       dum = Me.journal
    6.       If Len(Trim(dum)) < 1 Then
    7.          ival = 1
    8.          msg = msg & "No journal given." & vbCrLf
    9.       End If
    10.       If IsEmpty(Me.journal) Then
    11.          ival = 1
    12.       End If
    13.       If (Me.journal) = Null Then
    14.          ival = 7
    15.       End If
    16.    End If

    Does someone now of another way to check on it, which returns the correct answer?
    Last edited by swatty; Aug 9th, 2002 at 04:00 AM.
    Code:
    If Question = Incomplete Then
       AnswerNextOne
    Else
       ReplyIfKnown
    End If
    cu Swatty

  2. #2
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    what is Me.journal ?

    I'm a bit confused here.. could you elaborate?
    -= a peet post =-

  3. #3

    Thread Starter
    Frenzied Member swatty's Avatar
    Join Date
    Aug 2002
    Location
    somewhere on earth
    Posts
    1,478
    I've made a Class which has a private member.

    VB Code:
    1. Private mstr_journal         As String * 3
    2.  
    3. 'made some property let and get procedures to fill it up and read it.
    4. Property Let journal(ByVal str_journal As String)
    5.    mstr_journal = str_journal
    6. End Property
    7.  
    8. Property Get journal() As String
    9.    journal = mstr_journal
    10. End Property
    11. ' I made a function delete which deletes the related record in db
    12. 'accoring the key values given, here journal is a member of the key
    13. ' i try to evaluate the key values before trying to delete the record
    14. ' if the record is still related to other records they must be removed too
    15. 'therefore i try to evaluate the string if it was filled with a value
    16. 'but non of the below evaluations give me a correct answer
    17.   If IsNull(Me.journal) Or Me.journal = vbNullString Then
    18.       ival = 1
    19.       msg = msg & "No journal given." & vbCrLf
    20.    Else
    21.       dum = Me.journal
    22.       If Len(Trim(dum)) < 1 Then
    23.          ival = 1
    24.          msg = msg & "No journal given." & vbCrLf
    25.       End If
    26.       If IsEmpty(Me.journal) Then
    27.          ival = 1
    28.       End If
    29.       If (Me.journal) = Null Then
    30.          ival = 7
    31.       End If
    32.    End If
    In my classes i've made a property for each field in the table.

    For the text fields i've used strings with the exact size of them.
    Code:
    If Question = Incomplete Then
       AnswerNextOne
    Else
       ReplyIfKnown
    End If
    cu Swatty

  4. #4
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    'but non of the below evaluations give me a correct answer
    If IsNull(Me.journal) Or Me.journal = vbNullString Then
    you are sure that its either null or empty and that still does not give you a true ??

    I really don't get this...
    -= a peet post =-

  5. #5

    Thread Starter
    Frenzied Member swatty's Avatar
    Join Date
    Aug 2002
    Location
    somewhere on earth
    Posts
    1,478

    Did not post this in chit chat but seems to become a chatsession

    When you declare a string with a length.
    VB Code:
    1. Private mstr_journal         As String * 3
    vb fills them up with 

    all the test I am trying to see if someone filled it up doesn't work cause of them  in it.

    Someone with a answer how to test ??????
    Code:
    If Question = Incomplete Then
       AnswerNextOne
    Else
       ReplyIfKnown
    End If
    cu Swatty

  6. #6

    Thread Starter
    Frenzied Member swatty's Avatar
    Join Date
    Aug 2002
    Location
    somewhere on earth
    Posts
    1,478

    Little less conversation, little more action

    Found it.


    Thanks for those who helped me.
    Code:
    If Question = Incomplete Then
       AnswerNextOne
    Else
       ReplyIfKnown
    End If
    cu Swatty

Posting Permissions

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



Click Here to Expand Forum to Full Width