dmatos 0 Newbie Poster

Hello all

I'm getting the following runtime error when i try to open a report.
Error in formula: <Record_Selection> - A String is Required Here.

Any ideas? Thanks in advance!

Here is my code:

If OptConta.Value = True Then
        MDIForm1.Report.ReportFileName = App.Path & "\SREPCKSOL.RPT"
        FormatDateTime (DTDesde.Value)
        FormatDateTime (DTHasta.Value)
Reporte = " {T_SEC_Solicitudes.TSS_Fecha}>= date(" & Year(DTDesde.Value) & "," & Month(DTDesde.Value) & "," & Day(DTDesde.Value) & ")"
Reporte = Reporte & " and  {T_SEC_Solicitudes.TSS_Fecha}<= date(" & Year(DTHasta.Value) & "," & Month(DTHasta.Value) & "," & Day(DTHasta.Value) & ")"

    
     If Trim(DCCompania.Text) <> "" Then
      Reporte = Reporte & " and {C_Companias.Cc_Descr}=" & "'" & DCCompania.Text & "'"
     End If
     
    
         MDIForm1.Report.Formulas(0) = "Rango=" & "'" & ("Desde: " & Format(DTDesde.Value, "dd/MM/yyyy") & " Hasta: " & Format(DTHasta.Value, "dd/MM/yyyy")) & "'"
         MDIForm1.Report.Formulas(1) = "Compania=" & "'" & codCompania & "'"
         MDIForm1.Report.ReplaceSelectionFormula Reporte
         MDIForm1.Report.WindowState = crptMaximized
         MDIForm1.Report.WindowShowPrintSetupBtn = True
         MDIForm1.Report.WindowControls = True
         MDIForm1.Report.WindowControlBox = True
         MDIForm1.Report.WindowMaxButton = True
         MDIForm1.Report.WindowMinButton = True
         MDIForm1.Report.WindowShowCloseBtn = True
         MDIForm1.Report.WindowShowCancelBtn = True
         MDIForm1.Report.WindowShowNavigationCtls = True
         MDIForm1.Report.WindowShowProgressCtls = True
         MDIForm1.Report.WindowShowZoomCtl = True
         MDIForm1.Report.WindowShowSearchBtn = True
         MDIForm1.Report.Action = 1
         MousePointer = 0
         Exit Sub
            
    End If