|
-
Aug 9th, 2002, 02:28 AM
#1
Thread Starter
Frenzied Member
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:
If IsNull(Me.journal) Or Me.journal = vbNullString Then
ival = 1
msg = msg & "No journal given." & vbCrLf
Else
dum = Me.journal
If Len(Trim(dum)) < 1 Then
ival = 1
msg = msg & "No journal given." & vbCrLf
End If
If IsEmpty(Me.journal) Then
ival = 1
End If
If (Me.journal) = Null Then
ival = 7
End If
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
-
Aug 9th, 2002, 02:32 AM
#2
-= B u g S l a y e r =-
what is Me.journal ?
I'm a bit confused here.. could you elaborate?
-
Aug 9th, 2002, 02:41 AM
#3
Thread Starter
Frenzied Member
I've made a Class which has a private member.
VB Code:
Private mstr_journal As String * 3
'made some property let and get procedures to fill it up and read it.
Property Let journal(ByVal str_journal As String)
mstr_journal = str_journal
End Property
Property Get journal() As String
journal = mstr_journal
End Property
' I made a function delete which deletes the related record in db
'accoring the key values given, here journal is a member of the key
' i try to evaluate the key values before trying to delete the record
' if the record is still related to other records they must be removed too
'therefore i try to evaluate the string if it was filled with a value
'but non of the below evaluations give me a correct answer
If IsNull(Me.journal) Or Me.journal = vbNullString Then
ival = 1
msg = msg & "No journal given." & vbCrLf
Else
dum = Me.journal
If Len(Trim(dum)) < 1 Then
ival = 1
msg = msg & "No journal given." & vbCrLf
End If
If IsEmpty(Me.journal) Then
ival = 1
End If
If (Me.journal) = Null Then
ival = 7
End If
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
-
Aug 9th, 2002, 03:00 AM
#4
-= B u g S l a y e r =-
'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...
-
Aug 9th, 2002, 03:26 AM
#5
Thread Starter
Frenzied Member
Did not post this in chit chat but seems to become a chatsession
When you declare a string with a length.
VB Code:
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
-
Aug 9th, 2002, 04:01 AM
#6
Thread Starter
Frenzied Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|