Replicate Row_Number from SQL in Access

liammoohan

Board Regular
Joined
Jan 11, 2008
Messages
72
I am using the below VBA code in an attempt to replicate Row_Number() which can be done in SQL

This is the query I have written:

SELECT A.*, (SELECT COUNT(*) FROM tblRowNosTest WHERE A.PhoneNumber = PhoneNumber And A.ListName = ListName) AS RowNos
FROM tblRowNosTest as A
ORDER BY PhoneNumber, ListName, ContactAttempts

This is how the results are then displayed:

1665155222851.png


Column 'D' is displaying as an overall count; what I am trying to get to is that I want it to show as below (see column 'E'):

1665155344802.png


Any help would be greatly appreciated in being able to get the query to output the results to look like the values in column 'E' as oppose to what it is actually outputting in column 'D' highlighted yellow.

Thanks
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
something like post 5 here?
 
Upvote 0

Forum statistics

Threads
1,223,578
Messages
6,173,167
Members
452,504
Latest member
frankkeith2233

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top