Hi experts
Here I am with yet another problem.
I want to add data in a tree viewer controller dynamically from my database.
I am using ms-access as my back-end
Please help me ASAP.
Thank you in advance

Hi,

Open Recordset, Loop thru and Add Nodes:

Add Root Node:
Trvw.Nodes.Add , , "N1","First Node"

To Add Child to above Node:
TrVw.Nodes.Add "N1", tvwChild, "NC1", "ChildNode"

Change Node text / Key to the values returnde from database..

Regards
Veena

Hi QVeen
Can you do me a favour?. Please check this code

sSQL = "SELECT * FROM Master_final WHERE windows='" & TreeView1.Nodes.Item & "' and office ='" & TreeView1.Nodes.Item & "'"

Is this coding correct?

Hi
If not then how can we code a tree view for an sql query?
Thank you

Hi
Thank you.
I will just check the article.

Knowledge shared is knowledge gained.

Ankush,

I suggest you ALWAYS use properties for controls...
VB not require it when you're coding, BUT assumes "default properties" in this case...

Take a look:

'WITHOUT PROPERTY SPECIFICATION
Text1 = "Um texto qualquer"
'WITH PROPERTY SPECIFICATION
Text2.Text = "Um texto qualquer"

VB6 will "understand" the two lines above as the same thing, and you'll not get an error. If you pass a control for a sub or a function, instead, you will probably get strange fenomenous... your program can poltergeist the screen... ;)


Back on Earth, the line TreeView1.Nodes.Item doesn't point to a method or property, and you may get errors.
Try this little change:

If Not objLista.SelectedItem Is Nothing Then
      MsgBox objLista.SelectedItem.Key
      MsgBox objLista.SelectedItem.Text
    End If

- SelectedItem points to the selected item (dahn...) in the TreeView control;
- Key is the key defined for a single item (must be unique);
- Text is the text displayed for user.

And please take care about SQL syntax.
If you want to search records that match a criteria OR another criteria, you don't use AND operator...

See my comments for the UNION operator on the last post you'd write, VB6 + SQL (http://www.daniweb.com/forums/thread253844.html)... maybe this helps.


Success!
Sidnei

Hi QVeen
Can you do me a favour?. Please check this code

sSQL = "SELECT * FROM Master_final WHERE windows='" & TreeView1.Nodes.Item & "' and office ='" & TreeView1.Nodes.Item & "'"

Is this coding correct?

Hi

If optcombined.Value = True Then
     Set adorsRAM = New ADODB.Recordset
     For i = 0 To Node.Selected
sSQL = "SELECT * FROM Master_final WHERE windows='" & Node.Text & "' and office ='" & Node.Text & "'"
     Next

this code is showing an error

object variable or with block variable is not set.

how can i eliminate this error?
thanks in advance

Hi experts
i want a favour from you.
I want you all to provide with an example where tree view control is used with multiple select
Thank you in advance