Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2005

    Exclamation Unanswered: SQL Server Table to Excell

    Hi all. i hope you can help me.

    Im exporting an ado recordset (SQL Server) to Excel from vb6.

    This is what im doing but it only works on local server


    Public Sub Export()
    On Error GoTo Error
    Dim strSheetName As String
    Dim Conn As New ADODB.Connection

    CDB.DialogTitle = "Exportar Datos"
    CDB.Filter = "Archivos Excel (*.xls)|*.xls"
    CDB.FileName = "Bitacora"
    CDB.CancelError = True
    If CDB.FileName = "" Then Exit Sub
    If Conn.State = 1 Then Conn.Close
    Conn.CursorLocation = adUseServer
    Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source='" & CDB.FileName & "';Extended Properties=Excel 8.0;Persist Security Info=False"
    strSheetName = "CREATE TABLE `Bitacora` (`IdUser` VarChar (3) ,`IdMenu` VarChar (20) ,`Fecha` DateTime ,`Referencia` VarChar (60) ,`Actividad` VarChar (120) ,`IP` VarChar (15) ,`HN` VarChar (15) )"
    Conn.Execute strSheetName

    If Conn.State = 1 Then Conn.Close
    Conn.Open SisSession.SisConeccion
    strSheetName = "insert into OPENROWSET('Microsoft.Jet.OLEDB.4.0', 'Excel 8.0;Database=" & CDB.FileName & "; HDR=YES', 'SELECT * FROM [Bitacora]') " & AdoData.Source & ""

    Conn.Execute strSheetName

    MsgBox "Datos Exportados en " & Chr(13) & CDB.FileName, vbOKOnly + vbInformation
    Exit Sub
    If Err.Number = 0 Then Exit Sub
    ProcessError Err, Me.Name & " - Exportar", , , True
    End Sub


    Whe in configure the app for a network server it gives an error.

    OLE/DB provider returned message: Microsoft Jet culd not find the object 'Bitacora'. Make sure the object exists and the route is ok.

    This i assume is because the cange of the server from local to remote.

    Can you help me with a solution?

  2. #2
    Join Date
    Nov 2005
    Helloooooo someone pleaze

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts