Results 1 to 2 of 2

Thread: Datafield Not Found - Datareport

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2010
    Posts
    8

    Datafield Not Found - Datareport

    Hello,
    I have created a datreport using a dataenvironment and a parent / child commant.
    My parent command is cmdHeader and child is cmdDetail. My report works well so far, but I need to be able to change the sql statement in my cmdHeader command.
    I think I have succesfully figured out how to change the sql statement, but now I am getting "Datafield 'cmdDetail.REREAS' not found".

    I am still pretty new to vb, so you may have to speak slowly.

    In searching for this I have ran across issues of having to requery after changing the sql statement, so may code may have some unneeded lines in there all in an attemt to fix the issue.

    Please help, I am running out of hairs to pull out.

    Code:
    Private Sub cmdGo_Click()
    
    Dim strSQL As String
    
    strSQL = "SELECT AID, APN, AWO, ASEQ, EMNAME, AINSPDAT, SUM( NFAILQTY ) AS ""SumNfailqty"", PMDESC, ISECNP " & _
        "From NCM.NCM001P1 NCM001P1, NCM.NCM002P1 NCM002P1, HFADTA160.PM PM, HFADTA160.""IS"" TIS, HFADTA160.EM EM " & _
        "Where NCM001P1.AID = NCM002P1.NAID AND NCM001P1.APN = PM.PMPART AND PM.PMPART = TIS.ISPART AND NCM001P1.AINSPBY = EM.EMKEY " & _
        "Group By AID, APN, AWO, ASEQ, EMNAME, AINSPDAT, PMDESC, ISECNP"
    
    deCT.Commands("cmdHeader").CommandText = strSQL
    
    'Rebind After Using Requery Method
    
    'close if open
    If deCT.rscmdHeader.State = adStateOpen Then
    deCT.rscmdHeader.Close
    End If
    
    deCT.rscmdHeader.Open
    deCT.rscmdHeader.Requery
    
    With rptCautionTag
       Set .DataSource = deCT
       .DataMember = "cmdHeader"
       .Sections("Detail").Controls.Item("txtREREAS").DataMember = "cmdDetail"
       .Sections("Detail").Controls.Item("txtREREAS").DataField = ("REREAS")
       
    End With
    
        
        rptCautionTag.Orientation = rptOrientLandscape
        rptCautionTag.Show 1

  2. #2

    Thread Starter
    New Member
    Join Date
    May 2010
    Posts
    8

    Re: Datafield Not Found - Datareport

    I figured it out.

    I have to send the entire shaped sql string to the header command. Before I was only sending the string specific for my header command. When sending the entire shaped string to the DE it keeps the relationship between the parent & child.

    So before I was not getting any fields for my detail section of the report.

Posting Permissions

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



Click Here to Expand Forum to Full Width