-
February 16th, 2013, 10:33 PM
#1
Datareport Without Using DataEnvirontment
Hello Guys.. I am Using Data Report an not using Data Environtment
This is My Code
Code:
Sub receipt()
Dim rsReport As New ADODB.Recordset
rsReport.Open "Select Receipt, ProductName, Quantity, TotalPrice From Dailyrecord", acd, adOpenForwardOnly
If rsReport.RecordCount > 0 Then
Set DataReport1.DataSource = rsReport
With DataReport1
.Sections("Section2").Controls.Item("receipt").Caption = "Receipt"
.Sections("Section1").Controls("txtproduct").DataField = "ProductName"
.Sections("Section1").Controls("txtqty").DataField = "Quantity"
.Sections("Section1").Controls("txttotal").DataField = "TotalPrice"
.Show
End With
End If
End Sub
What is the problem in my code? Because when i run it,, Run Successful but in my receipt The Receipt number Show the Receipt name instead of the number in my database like 2013-0001 iam using MSACCESS database 2003 Help me guys.. The rest of my code is perfectly run.. Except in the section 2..
help me guys... hope you understand thanks in Adavance ^_^
-
February 17th, 2013, 02:53 AM
#2
Re: Datareport Without Using DataEnvirontment
Well I do not use the data report tool that comes with VB so I know very little about it but it looks like you are setting the caption to "Receipt" so I would expect the word Receipt to appear there on your report. If your intent was to use the data field receipt then one would think you need to assign the data field rather than the caption property.
Always use [code][/code] tags when posting code.
-
February 23rd, 2013, 05:00 AM
#3
Re: Datareport Without Using DataEnvirontment
Hello Sir But DataField not Allowed in Section 2.. What Should I Do? HElp me Sir
-
February 23rd, 2013, 11:45 AM
#4
Re: Datareport Without Using DataEnvirontment
Like I said I do not use that tool so I know very little about it. Looks like you would have to set that value through code or change the report a bit, can't say for sure.
Always use [code][/code] tags when posting code.
-
February 27th, 2013, 08:32 PM
#5
Re: Datareport Without Using DataEnvirontment
Sir thanks.. This is my code..
Run Perfectly
Code:
Sub receipt()
Dim rsReport As New ADODB.Recordset
Dim reciept1 As String
Dim Purchase1 As String
Dim name1 As String
rsReport.Open "Select purchase_date, Receipt, ProductName, Quantity, TotalPrice From Dailyrecord where Receipt ='" & lblrp.Caption & "' ", acd, adOpenForwardOnly
reciept1 = rsReport!receipt
Purchase1 = rsReport!purchase_date
name1 = MDIForm1.Label1.Caption
DataReport1.PrintReport True
If rsReport.RecordCount > 0 Then
Set DataReport1.DataSource = rsReport
With DataReport1
.Sections("Section2").Controls.Item("receipt").Caption = reciept1
.Sections("Section2").Controls.Item("lbldate").Caption = Purchase1
.Sections("Section5").Controls.Item("lblname").Caption = name1
.Sections("Section1").Controls("txtproduct").DataField = "ProductName"
.Sections("Section1").Controls("txtqty").DataField = "Quantity"
.Sections("Section1").Controls("txttotal").DataField = "TotalPrice"
.Show
End With
End If
SalesNew.Hide
End Sub
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|