DavidTigerch
MIS
Hi all . I have an application that i try to call Command7_Click() from with in Command5_Click function but when i do so i get the following error:
error:
If i click on a button manually to activate Command7_Click() the function inserts data to mysql without any error. Could any one tell me how to fix this error.Thanks
error:
Code:
Run-time error 91 object variable or with block variable not set
Code:
Private [B]Sub Command5_Click()[/B]
Select Case Index
Case 0:
If Text3.Text <> "" Then
Text4.Text = Inet1.OpenURL(Text3.Text, icString)
End If
Case 1:
End
End Select
[B]Command7_Click[/B]
End Sub
Private Sub Command7_Click()
Dim CNN As ADODB.Connection
Set CNN = New ADODB.Connection
CNN.Open "DRIVER={MySQL ODBC 3.51 Driver};SERVER=localhost;DATABASE=visualbasic67;USER=root;PASSWORD=;OPTION=3;"
Dim Parser As New clsXMLParser
Dim Node As clsXMLNode
Dim Child As clsXMLNode
Dim fn As Long
Dim i As Long
Dim path As String
Dim title As String
fn = FreeFile
Open "C:\temp.dat" For Output As #fn
Print #fn, Text4.Text
Close #fn
Call Parser.Parse("C:\temp.dat")
Call Kill("C:\temp.dat")
Set Node = Parser.ParentNode
For i = 1 To Node.ChildrenCount
Set Child = Node.enumChild(i)
If LCase$(Child.Name) = "song" Then
path = Child.getAttribute("path")
title = Child.getAttribute("title")
[COLOR=red]CNN.Execute "INSERT INTO songstest (filename,title,artist,album,LastModified) VALUES('" & path & "','" & title & "','" & Trim(ListView1.ListItems(ListView1.SelectedItem.Index).SubItems(2)) & "','" & Trim(ListView1.ListItems(ListView1.SelectedItem.Index).SubItems(3)) & "' , '" & List3.Text & "')"
[/color] ===> error pointing at
End If
Next
CNN.Close
MsgBox " successfull"
End Sub