borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (Error 3426)Next Topic (Transferring Records) New Topic New Poll Post Reply
AndreaVB Forum : Database : problem with passing node.tag
Poster Message
natashag
Level: Guest


icon problem with passing node.tag

node.tag will not pass to my DeptList private function. Node.tag will get the information, but just will not send it.

Error highlighted in yellow ^^ Private Function DeptList(intID As Integer) As String
Error highlighted in grey ^^ .movenext
========================================

Private Sub tvwOffices_NodeClick(ByVal Node As Node)
    
    If Node.Tag <> "" Then
        txtDeptList.Text = DeptList(Node.Tag)
    Else
        txtDeptList.Text = ""
    End If

End Sub
----------------------------------------
Private Function DeptList(intID As Integer) As String

Dim strSql As String, str As String, strMsg2

strSql = "Select * from tblEmployees where fldDepartmentID = " & intID

adcEmp.RecordSource = strSql
adcEmp.Refresh

Do

   str = str & adcEmp.Recordset("fldName") & adcEmp.Recordset("fldPhone") & vbNewLine
   adcEmp.MoveNext

Loop Until adcEmp.Recordset.EOF

txtDeptList.Text = str

End Function

11-12-2002 at 11:39 PM
| Quote Reply
JLRodgers
Level: Moderator

Registered: 04-04-2002
Posts: 1618
icon Re: problem with passing node.tag

Offhand, you should:
1) convert the tag to an integer
2) test to make sure your not at the BOF/EOF of the recordset before storing the values into a string variable

Although there are numerous (potential) problems...

Is adcEmp a control? If so you shouldn't be using it the way you are, unless you need results displayed.
If it's a variable for a connection, you can't do what you're trying to do.

For:
txtDeptList.Text = DeptList(Node.Tag)
it will set the return value to the result, given your code it will ALWAYS be ""

For:
txtDeptList.Text = str
in the function, it should be:
DeptList=str

12-12-2002 at 04:32 AM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
AndreaVB Forum : Database : problem with passing node.tag
Previous Topic (Error 3426)Next Topic (Transferring Records) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder