Results 1 to 3 of 3

Thread: [RESOLVED] need help with Data report groups

  1. #1

    Thread Starter
    Frenzied Member d3gerald's Avatar
    Join Date
    Jan 2006
    Posts
    1,348

    Resolved [RESOLVED] need help with Data report groups

    i need help badly with this one

    i need to show this data report using shape sql

    here's some code
    VB Code:
    1. Option Explicit
    2. Dim cnRep As New ADODB.Connection
    3. Dim rs As New ADODB.Recordset
    4. Dim com As New ADODB.Command
    5.  
    6. Private Sub DataReport_Initialize()
    7.     cnRep.CursorLocation = adUseClient
    8.     cnRep.Provider = "MSDataShape"
    9.     cnRep.Open "Data Provider = Microsoft.Jet.OLEDB.4.0; Data Source = " & ConnectStringVal & ";Jet OLEDB"
    10.     com.CommandText = "SHAPE {SELECT ReceivingDetails.RefNo As RefNo, Products.PartNo As PartNo, Products.Description As Description, ReceivingDetails.Qty As Qty, Receiving.CurrencyUsed & Format(ReceivingDetails.UnitPrice,'###,###,###,##0.00') As UnitPrice, Receiving.CurrencyUsed & Format(ReceivingDetails.SubTotal,'###,###,###,##0.00') as SubTotal, ReceivingDetails.ReceivingNo FROM ReceivingDetails, Products, Receiving WHERE ReceivingDetails.ProdCode = Products.ProductCode AND ReceivingDetails.ReceivingNo = Receiving.ReceivingNo AND ReceivingDetails.ReceivingNo = 'RR-060000001'} As rsReceiving APPEND ({SELECT SerialNo, ReceivingNo FROM ReceivingSerials} AS rsSerials RELATE ReceivingNo to ReceivingNo)"
    11.     com.ActiveConnection = cnRep
    12.     com.CommandType = adCmdText
    13.     com.Execute
    14.    
    15.     rs.ActiveConnection = cnRep
    16.     rs.CursorLocation = adUseClient
    17.     rs.Open com
    18.     Set rptRec.DataSource = rs
    19.    
    20.     With rptRec
    21.         With .Sections("rsReceiving_Header")
    22.             .Controls("txtRefNo").DataMember = "rsReceiving"
    23.             .Controls("txtRefNo").DataField = rs.Fields(0).Name
    24.             .Controls("txtPartNo").DataMember = "rsReceiving"
    25.             .Controls("txtPartNo").DataField = rs.Fields(1).Name
    26.             .Controls("txtDesc").DataMember = "rsReceiving"
    27.             .Controls("txtDesc").DataField = rs.Fields(2).Name
    28.             .Controls("txtQty").DataMember = "rsReceiving"
    29.             .Controls("txtQty").DataField = rs.Fields(3).Name
    30.             .Controls("txtUnitP").DataMember = "rsReceiving"
    31.             .Controls("txtUnitP").DataField = rs.Fields(4).Name
    32.             .Controls("txtSTtl").DataMember = "rsReceiving"
    33.             .Controls("txtSTtl").DataField = rs.Fields(5).Name
    34.         End With
    35.         .Sections("rsSerials_Detail").Controls("txtSerial").DataMember = "rsSerials"
    36.         .Sections("rsSerials_Detail").Controls("txtSerial").DataField = rs.Fields(0).Name
    37.     End With
    38. End Sub

    and heres the design of my data report
    Attached Images Attached Images  
    On error goto Trap

    Trap:
    in case of emergency, drop the case...

    ****************************************
    If this post has been resolved. Please mark it as "Resolved" by going through the "Thread Tools" above and clicking on the "Mark Thread Resolved " option.
    if a post is helpful to you, Please Rate it by clicking on the Rate link right below the avatar

  2. #2
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: need help with Data report groups

    You did not specify the problem but I noticed these two

    Do not set the DataMember property for controls whose DataField property references a field in the Parent recordset.

    To Reference Field names in the Child recordset use

    rs.Fields(2).Value.Fields(1).Name

  3. #3

    Thread Starter
    Frenzied Member d3gerald's Avatar
    Join Date
    Jan 2006
    Posts
    1,348

    Re: need help with Data report groups

    thnx bruce, actually the problem i got with it is that when i run that code, it give out an error showing DataField rsReceiving.Qty not found.

    and last night, due to my despair, i commented out those lines setting the datamember property of the rptTextboxes and furtunately, it worked.

    anyway, thanks for the reply, thats additional idea and explanation y i encounter such problem
    On error goto Trap

    Trap:
    in case of emergency, drop the case...

    ****************************************
    If this post has been resolved. Please mark it as "Resolved" by going through the "Thread Tools" above and clicking on the "Mark Thread Resolved " option.
    if a post is helpful to you, Please Rate it by clicking on the Rate link right below the avatar

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