Results 1 to 5 of 5

Thread: Urgent Data Report Problem

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Oct 2006
    Posts
    81

    Urgent Data Report Problem

    VB Code:
    1. [SIZE=3]
    2. Private Sub cmdPrint_Click()
    3. Dim rsPrint As New ADODB.Recordset
    4.  
    5. Set rptStore.DataSource = rsPrint
    6. rptStore.DataMember = rsPrint.DataMember
    7. strSQL = "SELECT * FROM StorePOS WHERE Flag <> 'D'"
    8. rsPrint.Open strSQL, Conn, adOpenKeyset, adLockOptimistic
    9. rsPrint.Filter = "ID = " & txtFields(txtID_StoreID).Text & " "
    10.  
    11. 'Set Textbox Datafields
    12. With rptStore.Sections("Section6").Controls       'Section is the section you create in datareport
    13.     .Item("txtCompleteAddress").DataField = rsPrint.Fields("CompleteAddress").Name
    14.     .Item("txtID").DataField = rsPrint.Fields("ID").Name
    15.     .Item("txtStoreName").DataField = rsPrint.Fields("StoreName").Name
    16.     .Item("txtMotherStore").DataField = rsPrint.Fields("MotherStore").Name
    17.     .Item("txtOwnershipType").DataField = rsPrint.Fields("OwnershipType").Name
    18.     .Item("txtDateOpened").DataField = rsPrint.Fields("DateOpened").Name
    19.     .Item("txtStoreType").DataField = rsPrint.Fields("StoreType").Name
    20.     .Item("txtStatus").DataField = rsPrint.Fields("Status").Name
    21.     .Item("txtNew").DataField = rsPrint.Fields("New").Name
    22.     .Item("txtStatusDate").DataField = rsPrint.Fields("StatusDate").Name
    23.     .Item("txtTransferred").DataField = rsPrint.Fields("TransferredFrom").Name
    24. End With
    25. rptStore.Refresh
    26. rptStore.Show 1
    27. [/SIZE]
    I have this code but I got error message "Datafield "(Empty)" not found." This is done without Data Environment. Please help me with the code. Thanks.

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

    Re: Urgent Data Report Problem

    The DataField property of one or more controls on the report has not been set.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Oct 2006
    Posts
    81

    Re: Urgent Data Report Problem

    Quote Originally Posted by brucevde
    The DataField property of one or more controls on the report has not been set.
    How can I set the Datafield? Please help me with the code. Thanks.

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

    Re: Urgent Data Report Problem

    Are you kidding? You posted code that does just that!

  5. #5
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Urgent Data Report Problem

    Moved to reporting

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