|
-
May 22nd, 2001, 05:18 PM
#1
see if field is null
hello everyone,
I am trying to load a treeview (ya still) and I get it to load the child no problem, but I want to load the field that is empty as a folder child. this is my code.
Code:
Dim SelectString As String
SelectString = "Select * from Routine where [Counter]= " + Label2
Set rsFiltered = dbName.OpenRecordset(SelectString)
Do While Not rsFiltered.EOF
'Add routine nodes
If rsRoutines.Fields("ParentID") > "0" Then
tvwMain.Nodes.Add "Routine" & rsRoutines("ParentID"), _
tvwChild, "Routine" & rsFiltered("counter"), _
rsFiltered("Routine"), "code", "codered"
'Else
If rsRoutines.Fields("Description") = Null Then
tvwMain.Nodes.Add "Routine" & rsRoutines("ParentID"), _
tvwChild, "Routine" & rsRoutines("counter"), _
rsRoutines("Routine"), "closed", "open"
End If
End If
rsFiltered.MoveNext
Loop
rsRoutines.MoveNext
Loop
'Code improved by vBulletin Tool (Save as...)
ok it loads child nodes if the field ParentID > 0, but the folder child I want to load is also greater than 0 so I was trying to load it by another field. I don't think this is working because it already loaded it in the previous if..then statement.
How do I change it to load if ParentID > 0 but if the Description field if empty to load it as folder child. does any of that make since?
TIA
-
May 22nd, 2001, 05:44 PM
#2
No doesn't make sense????
If Len(Trim(stringhere)) > 0 Then
any help?
-
May 22nd, 2001, 05:49 PM
#3
Use the IsNull function to determine if it's null
Code:
If IsNull(rsRoutines.Fields("Fld")) Then MsgBox "Null"
-
May 22nd, 2001, 06:13 PM
#4
Originally posted by Megatron
Use the IsNull function to determine if it's null
Code:
If IsNull(rsRoutines.Fields("Fld")) Then MsgBox "Null"
Was thinking of that, but wasn't sure if it was fully functional in vb6 yet. The function IIF occasionally turns up really weird results so have keeped clear of IsNull
COuld you restate the line as
If IsNull(rsRoutines!Fld) Then Msgbox "***"
just a thought.
-
May 22nd, 2001, 06:18 PM
#5
Originally posted by Jethro
Was thinking of that, but wasn't sure if it was fully functional in vb6 yet.
It works fine in VB5, so I presumed that it would work in VB6 as well.
-
May 22nd, 2001, 06:44 PM
#6
ok I can see what you guys are talking about but,,
let me see if I can explain this better. this is an excert from another thread I was having Techman helping on. maybe Null was not what I was after.
When stored in the database the main root folder has a ID (counter, 100 for eg.), but it also has a ParentID (0) to make it the root folder. so if a new folder is under that folder it would have the ParentID of the folder it is under (100) and then it would have a regular counter key another number. so all folders under the main root folder would have a ParentID (reference key) of 100 as that of the root folder. if you want ot read more about an see some pictures, read this post
that might help explain what I'm doing.
-
May 23rd, 2001, 01:11 PM
#7
ok still a little confusing??
let me re-word the question.
How can I insert a field from a DB that is empty in to the tree as a child from the code above. I tried this
Code:
If IsNull(rsRoutines.Fields("Description")) Then
tvwMain.Nodes.Add "Routine" & rsRoutines("ParentID"), _
tvwChild, "Routine" & rsFiltered("counter"), _
rsFiltered("Routine"), "closed", "open"
but it comes back and tells me "element not found" and highlights the code above but points to the bold line.
-
May 24th, 2001, 11:47 AM
#8
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
|