Solved

Enumerate Results in SQL Query?

Posted on 2008-10-14
4
640 Views
Last Modified: 2012-05-05
Is there any clean way to enumerate the results of an SQL query in a listbox?  The main reason for asking this is that I need a way to count the row/results so if I sort them, the row number is consistent.  Thanks in advance^
strlist2 = "SELECT (SELECT Count(ID) FROM Assignments WHERE [Associate_name] = '" & assoc_ind & "' AND " & _
           "Month([Assignment_Date]) = Month(Now())) as Count_rec, Assigned_to, [Number], [Type], [Assigned_by], [Assignment_Date] FROM Assignments " & _
           "WHERE [Associate_name] = '" & assoc_ind & "' AND Month([Assignment_Date]) = Month(Now()) ORDER BY 6;"

Open in new window

0
Comment
Question by:jad0083
4 Comments
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 22715207
you can set the row source of the listbox using strlist2

me.listbox.rowsourcetype="table/query"
me.listbox.rowsource=strlist2
0
 

Author Comment

by:jad0083
ID: 22715307
Uhm, I already have that variable as the rowsource of the listbox.  Problem is that on one of the columns of the listbox, I would want to have an enumeration:

Something like this:

Enumeration | Count |  Assigned_to | Number | Type | Assigned_by | Assignment_Date
       1                3            joe                     5       P             sam                    10/06/08
       2                2             jack                  4         A            bill                     10/04/08
       3                 7            Dude                3          C          Frank                   10/08/08
       4                 1             Paul                 8         B            Steve                     10/10/08                    


Thanks!
0
 

Accepted Solution

by:
ee_auto earned 0 total points
ID: 23268825
Question PAQ'd, 500 points refunded, and stored in the solution database.
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
This article describes how to use the timestamp of existing data in a database to allow Tableau to calculate the prior work day instead of relying on case statements or if statements to calculate the days of the week.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question