Hi. I'm in need of hepl.
I have the following code for creating a report at runtime
It works fine until it reaches "rap.Show vbModal" when it shows the report. I get an error message: DataFiled "Ord1" Not Found.Code:Private Sub cmdRaport_Click() Dim rs As New ADODB.Recordset Dim cn As ADODB.Connection Dim rap As New DataReport1 Dim StrSQL As String Set cn = New ADODB.Connection cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source= " & App.Path & "\db\Model.mdb" cn.Open StrSQL = "SELECT * FROM Hordere WHERE OrderID = " & ordID Set rs = cn.Execute(StrSQL) 'Header and Report caption With rap.Sections("RepHeader") .Controls("lblFirm").Caption = frmMain.mccFirma.Text End With ' rap.Caption = frmMain.cboOrder.Text rap.Sections("PgHeader").Controls("lblPH").Caption = "PROCES TEHNOLOGIC" With rap.Sections("ordHead") .Controls("lblOrd").Caption = "Order:" .Controls("lblMod").Caption = "Model:" .Controls("txtOrd").DataField = frmMain.cboOrder.Text .Controls("txtMod").DataField = frmMain.mccModClient.Text End With Set rap.DataSource = rs With rap.Sections("ordDet") .Controls("txtCod").DataField = "CodOP" .Controls("txtOp").DataField = "Operatii" .Controls("txtNMunc").DataField = "Nrmunc" .Controls("txtNT").DataField = "NT" .Controls("txtNP").DataField = "NP" End With rap.Show vbModal rs.Close Unload rap Set rs = Nothing Set rap = Nothing End Sub
Ord1 is the name of the order. What did i do wrong?
Pls Help it's urgent
Thanks and regards
Addict


Reply With Quote
