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.