|
-
Apr 10th, 2007, 06:40 AM
#1
Thread Starter
Addicted Member
[RESOLVED] serial no in datareport
Hi friends,
How to generate automatically serial nos. in datareport.
Suppose if it displays 100 employee's payment report,serial no.should be generated from 1-100.Please help me?
-
Apr 10th, 2007, 06:45 AM
#2
Re: serial no in datareport
Add a autonumber field to the table and bind that to the Serial Number
-
Apr 10th, 2007, 07:07 AM
#3
Thread Starter
Addicted Member
Re: serial no in datareport
Thanks.
Is it possible if we merge two tables also?Please explain how to do!
-
Apr 10th, 2007, 07:16 AM
#4
Thread Starter
Addicted Member
Re: serial no in datareport
But if we want to print report for deptwise,can we use auto serialno?
-
Apr 10th, 2007, 07:18 AM
#5
Re: serial no in datareport
instead you can consider generating Serial Number at the query result itself...
If an answer to your question has been helpful, then please, Rate it!
Have done Projects in Access and Member management systems using BioMetric devices, Smart cards and BarCodes.
-
Apr 10th, 2007, 07:20 AM
#6
Re: serial no in datareport
How are you setting up the report at the moment? Through the data environment or at run-time through set datasource = recordset? And what's the SQL that fills the command object/recordset?
-
Apr 10th, 2007, 07:30 AM
#7
Thread Starter
Addicted Member
Re: serial no in datareport
using query,how to generate ?Please give one example.
Code:
vb Code:
Private Sub cmdOk_Click()
On Error Resume Next
If Txtdate = "" Then
flag = MsgBox("Display Entire Issued Report?", vbYesNo + vbQuestion, "Materials System")
If flag = vbYes Then
If Rs.State = adStateOpen Then
Rs.Close
End If
Rs.open "Select * from Sale where qty>0", conn
Set IssdateReport.DataSource = Rs
Load IssdateReport
IssdateReport.Show
Unload Me
Else
Exit Sub
Txtdate.SetFocus
End If
Else
If Rs.State = adStateOpen Then
Rs.Close
End If
Rs.open "select * from Salesnew where date between '" & Txtdate.Text & "'and '" & txtdateto.Text & "'", conn
Set IssdateReport.DataSource = Rs
Load IssdateReport
IssdateReport.Show
Unload Me
End If
End Sub
-
Apr 10th, 2007, 08:00 AM
#8
Re: serial no in datareport
I see your getting a subset based on dates... you might want to read this first http://www.vbforums.com/showthread.php?t=450993 and decide if its feasible or not to pursue a subquery solution.
You can also try printing out your data with Excel or a better reporting tool since the data report is too basic.
-
Apr 11th, 2007, 05:47 AM
#9
Thread Starter
Addicted Member
Re: serial no in datareport
Thanks.
Is it possible to include serial no. in datareport through data environment?
-
Apr 11th, 2007, 01:21 PM
#10
Re: serial no in datareport
Is the serial number the number of the record in the report, or is it the number of sale? (IOW, should a particular sale have the same serial number every time it appears on a report, or should the numbers start over for each report?)
The most difficult part of developing a program is understanding the problem.
The second most difficult part is deciding how you're going to solve the problem.
Actually writing the program (translating your solution into some computer language) is the easiest part.
Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.
Please Help Us To Save Ana
-
Apr 11th, 2007, 01:42 PM
#11
Re: serial no in datareport
-
Apr 11th, 2007, 11:56 PM
#12
Thread Starter
Addicted Member
Re: serial no in datareport
Thanks.
Serial number should come according to the no.of rows retrieved for that particular report.
For example,if we want to display the no.of employees(ex.125 emp.) in a particular dept. , serial no.s should be generated from 1-125 in a report.
-
Apr 12th, 2007, 03:31 AM
#13
Re: serial no in datareport
I think the only way to add a serial number is to make it a part of the query.Check this
Code:
SELECT (select count(a2.emp_no) from tblEMP as a2
where a1.emp_no<=a2.emp_no) AS [SL No],
a1.name, a1.address FROM account AS a1
GROUP BY a1.emp_no, a1.name, a1.address
ORDER BY a1.emp_no DESC
-
Apr 12th, 2007, 05:27 AM
#14
Re: serial no in datareport
Yes amrita, as an aggregate query (count) that is a subquery... for a1.emp_no<=a2.emp_no to work properly as intended, refer to link in post #8... also, such an implementation will also involve additional overhead moreso with lots of returned records.
-
Apr 13th, 2007, 04:39 AM
#15
Re: serial no in datareport
 Originally Posted by Akshaya
using query,how to generate ?Please give one example.
Check my signature for "Add Serial Number / Row Number to SQL Queries" to add serial / row number to a query
If an answer to your question has been helpful, then please, Rate it!
Have done Projects in Access and Member management systems using BioMetric devices, Smart cards and BarCodes.
-
Apr 14th, 2007, 12:23 AM
#16
Thread Starter
Addicted Member
Re: serial no in datareport
Thanks friends.
I used the following query.It is working fine.
But Serno comes in desc order by default.How to arrange in asc. order?
Code:
SELECT Code, Name, grade,remarks,(SELECT COUNT(*) FROM Customer C2 WHERE C2.code >= C.Code) AS SerNo FROM Customer C
-
Apr 14th, 2007, 02:04 AM
#17
Thread Starter
Addicted Member
Re: serial no in datareport
Thanks friends.It is working fine in this code.
Code:
SELECT code, name, grade,remarks,(SELECT COUNT(*) FROM Customer C2 WHERE C2.Code >= C.Code) AS SerNo FROM Customer C order by c.code desc
-
Apr 14th, 2007, 02:39 AM
#18
Re: serial no in datareport
 Originally Posted by Akshaya
Thanks friends.It is working fine in this code.
Code:
SELECT code, name, grade,remarks,(SELECT COUNT(*) FROM Customer C2 WHERE C2.Code >= C.Code) AS SerNo FROM Customer C order by c.code desc
Thanks for sharing the solution
-
Apr 15th, 2007, 11:31 PM
#19
Re: [RESOLVED] serial no in datareport
Akshaya: if you change the greater than symbol in the query to lesser than symbol it would give you the result what do u want...
for more explanation please refer this
If an answer to your question has been helpful, then please, Rate it!
Have done Projects in Access and Member management systems using BioMetric devices, Smart cards and BarCodes.
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
|