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:
  1. Private Sub CmdWriteCDGDIR_Click()
  2.  
  3. Set gorsgetkaraoke = New ADODB.Recordset
  4. Set gorsgetkaraoke = goEnv.getkaraoke(goEnv.Cnn, CLng(songnum), Trim(singer), Trim(song), Trim(Path))
  5.  
  6. Open "C:\directory.txt" For Output As #1
  7. gorsgetkaraoke.MoveFirst
  8. While Not gorsgetkaraoke.EOF
  9.     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)
  10.    
  11.     gorsgetkaraoke.MoveNext
  12. Wend
  13. Close
  14.  
  15. End Sub

bugs out on the below line at the clng (songnum) which is an autonumber..

VB Code:
  1. goEnv.getkaraoke(goEnv.Cnn, CLng(songnum), Trim(singer), Trim(song), Trim(Path))


heres the sql statement :

VB Code:
  1. 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
  2.  
  3.    On Error GoTo No_Bugs
  4.    
  5.     Dim oRs As ADODB.Recordset
  6.     Dim ssql As String
  7.    
  8.     ssql = "SELECT *"
  9.     ssql = ssql & " FROM"
  10.     ssql = ssql & " sunfly"
  11.    
  12.  
  13.     Set oRs = New ADODB.Recordset
  14.     oRs.Open ssql, goEnv.Cnn, adOpenKeyset, adLockOptimistic, adCmdText
  15.     Set getkaraoke = oRs
  16.     Set oRs = Nothing
  17.     Exit Function
  18.  
  19.    
  20. No_Bugs:
  21.    
  22.     MsgBox Err.Number & " - " & Err.Description, vbOKOnly + vbInformation
  23.  
  24. 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)