Solved

Enumerate Results in SQL Query?

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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
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.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

719 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