Solved

Enumerate Results in SQL Query?

Posted on 2008-10-14
4
642 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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

Suggested Solutions

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 a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

726 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