Urgent Data Report Problem
VB Code:
[SIZE=3]
Private Sub cmdPrint_Click()
Dim rsPrint As New ADODB.Recordset
Set rptStore.DataSource = rsPrint
rptStore.DataMember = rsPrint.DataMember
strSQL = "SELECT * FROM StorePOS WHERE Flag <> 'D'"
rsPrint.Open strSQL, Conn, adOpenKeyset, adLockOptimistic
rsPrint.Filter = "ID = " & txtFields(txtID_StoreID).Text & " "
'Set Textbox Datafields
With rptStore.Sections("Section6").Controls 'Section is the section you create in datareport
.Item("txtCompleteAddress").DataField = rsPrint.Fields("CompleteAddress").Name
.Item("txtID").DataField = rsPrint.Fields("ID").Name
.Item("txtStoreName").DataField = rsPrint.Fields("StoreName").Name
.Item("txtMotherStore").DataField = rsPrint.Fields("MotherStore").Name
.Item("txtOwnershipType").DataField = rsPrint.Fields("OwnershipType").Name
.Item("txtDateOpened").DataField = rsPrint.Fields("DateOpened").Name
.Item("txtStoreType").DataField = rsPrint.Fields("StoreType").Name
.Item("txtStatus").DataField = rsPrint.Fields("Status").Name
.Item("txtNew").DataField = rsPrint.Fields("New").Name
.Item("txtStatusDate").DataField = rsPrint.Fields("StatusDate").Name
.Item("txtTransferred").DataField = rsPrint.Fields("TransferredFrom").Name
End With
rptStore.Refresh
rptStore.Show 1
[/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.
Re: Urgent Data Report Problem
The DataField property of one or more controls on the report has not been set.
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.
Re: Urgent Data Report Problem
Are you kidding? You posted code that does just that!
Re: Urgent Data Report Problem