?
Solved

Enumerate Results in SQL Query?

Posted on 2008-10-14
4
Medium Priority
?
651 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

770 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