Kamis, 21 November 2013

[MS_AccessPros] Add Row Number to Query

 

How can I add a Sequential Row number to my Query?.

 

My current Query looks like this:

SELECT Patient.[last name] & "," & Patient.[first name] AS [Registrants Name], insurance.iname AS MLTC, Patient.[start date] AS [Start Date], Patient.[end date] AS [End Date], Patient.recertdate AS [Recertification Date]
FROM (Patient LEFT JOIN shift ON Patient.[preferred shift] = shift.[Shift #]) INNER JOIN insurance ON Patient.insrcd = insurance.insrcd
WHERE ....
ORDER BY Patient.[last name], Patient.[first name], Patient.mi, Patient.[patient id];

 

The above works fine, but now  I want to add a sequential row number to each line starting at 1 and increase it by 1 for each line.

So I changed it to:

SELECT DCount("[Registrants Name]","mltc1a","[Registrants Name] <= " & [Registrants Name]) AS row, Patient.[last name] & "," & Patient.[first name] AS [Registrants Name], etc.

But I get the following error:

Syntax error (comma) in query expression '[Registrants Name] <= John,Doe'.

I thought the cause might be the [registrant name] because it contains a comma.

Is there any way to do this?.

As always thanks in advance for all your help.

Sarah

 

__._,_.___
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (1)
Recent Activity:
.

__,_._,___

Tidak ada komentar:

Posting Komentar