2012-04-24 8 views
0

私はこのコードを書いたが、私は持って「ファイル名を指定して実行時エラー 『91』:」VB + Crystalレポート

Private Sub Command1_Click() 
    Set rs = New ADODB.Recordset 
    openConnection 

    If Me.cmbMonth = "" And Me.cmbYear = "" Then 
     MsgBox "Please select MONTH and YEAR" 
     Exit Sub 
    End If 

    With crystalrpt 

     .ReportFileName = App.Path & "\Report\VariableReport.rpt" <-- ERROR IS HERE 
     .SelectionFormula = "{SW.dtaMonth}='" & cmbMonth.Text & "' and {SW.dtaYear}=" & dtaYear.Text & "" & _ 
     " and {SFW.dtaMonth}='" & cmbMonth.Text & "' and {SFW.dtaYear}=" & dtaYear.Text & "" & _ 
     " and {OT.dtaMonth}='" & cmbMonth.Text & "' and {OT.dtaYear}=" & dtaYear.Text & "" & _ 
     " and {CL.dtaMonth}='" & cmbMonth.Text & "' and {CL.dtaYear}=" & dtaYear.Text & "" & _ 
     " and {RM.dtaMonth}='" & cmbMonth.Text & "' and {RM.dtaYear}=" & dtaYear.Text & "" & _ 
     " and {EL.dtaMonth}='" & cmbMonth.Text & "' and {EL.dtaYear}=" & dtaYear.Text & "" & _ 
     " and {TRANS.dtaMonth}='" & cmbMonth.Text & "' and {TRANS.dtaYear}=" & dtaYear.Text & "" & _ 
     " and {WD.dtaMonth}='" & cmbMonth.Text & "' and {WD.dtaYear}=" & dtaYear.Text & "" & _ 
     " and {MP.dtaMonth}='" & cmbMonth.Text & "' and {MP.dtaYear}=" & dtaYear.Text & "" & _ 
     " and {NONSTOCK.dtaMonth}='" & cmbMonth.Text & "' and {NONSTOCK.dtaYear}=" & dtaYear.Text & "" & _ 
     " and {PACK.dtaMonth}='" & cmbMonth.Text & "' and {PACK.dtaYear}=" & dtaYear.Text & "" 
     .WindowTitle = "Report" 
     .Action = 1 'Will Show The Report 

    End With 

End Sub 
+0

オブジェクトにcrystalreportを設定した場所がわかりません。 – Fionnuala

答えて

0

をそれはあなたがクラスからクラス(オブジェクト)のインスタンスを作成しようとしている可能性がありますそれはあなたがそれをテストしたマシン上にありますが、マシンには配置されていません。例えば、私はVBプログラムがNero Burning Romのクラスを利用できるようにすることができます。 Neroオブジェクトを作成してメソッドやプロパティを使用することはできますが、Neroライブラリがインストールされているマシンでのみ動作します。それがインストールされていない場合、オブジェクトを作成しようとすると(newまたはcreateobjectを使用して早期バインディングまたは遅延バインディングを使用して)、オブジェクトが参照されるべき変数は、ライブラリが要求されたインスタンスを作成できなかったため、クラス.....