it was working great till i tried to compile...
hi guys ..
this little bit of code worked great till i tried to compile it - now it bugs out on variable not defined...can any one help?
VB Code:
Private Sub CmdWriteCDGDIR_Click()
Set gorsgetkaraoke = New ADODB.Recordset
Set gorsgetkaraoke = goEnv.getkaraoke(goEnv.Cnn, CLng(songnum), Trim(singer), Trim(song), Trim(Path))
Open "C:\directory.txt" For Output As #1
gorsgetkaraoke.MoveFirst
While Not gorsgetkaraoke.EOF
Print #1, gorsgetkaraoke!ID & Chr$(44) & Chr$(34) & gorsgetkaraoke!singer & Chr$(34) & Chr$(44) & Chr$(34) & gorsgetkaraoke!song&; Chr$(34) & Chr$(44) & Chr$(34) & 0 & Chr$(34) & Chr$(44) & Chr$(34) & gorsgetkaraoke!Path & Chr$(34) ' & Chr$(44) & Chr$(34) & "K" & Chr$(34)
gorsgetkaraoke.MoveNext
Wend
Close
End Sub
bugs out on the below line at the clng (songnum) which is an autonumber..
VB Code:
goEnv.getkaraoke(goEnv.Cnn, CLng(songnum), Trim(singer), Trim(song), Trim(Path))
heres the sql statement :
VB Code:
Public Function getkaraoke(ByRef oCnn As ADODB.Connection, ByVal songnum As Long, ByVal singer As String, ByVal song As String, ByVal Path As String) As ADODB.Recordset
On Error GoTo No_Bugs
Dim oRs As ADODB.Recordset
Dim ssql As String
ssql = "SELECT *"
ssql = ssql & " FROM"
ssql = ssql & " sunfly"
Set oRs = New ADODB.Recordset
oRs.Open ssql, goEnv.Cnn, adOpenKeyset, adLockOptimistic, adCmdText
Set getkaraoke = oRs
Set oRs = Nothing
Exit Function
No_Bugs:
MsgBox Err.Number & " - " & Err.Description, vbOKOnly + vbInformation
End Function
this is total pants - it takes me all my time to write code that works then the compiler wastes it for me!
davie.
(i know its my fault somehow , but its nice to lay the blame somewhere else for a short while)