View Full Version : increment a number within each record


jgriffi
11-01-2007, 05:27 AM
I have a set of questions, each has part 1-5 to it but in the report I want these part numbers to run sequentially instead of showing 1-5 with each question, i.e Question 1 on the first page has parts 1-5, Question 2 on the 2nd page has parts 6-10, Question 3 has parts 11-15 etc. I can get numbers to increase sequentially on each page (using the running sum property) but not within each page.

I wrote this code for a Word macro (in VB):

ans = Integer
If ans = Null
ans = 0
Else ans = ans + 1

Do you know how I could write this in an Access expression in the report or is there a better way to do it?

gemma-the-husky
11-01-2007, 08:32 AM
in your query, use a calculated field eg

questionindex : (part-1) * 5 + questionnumber

then questionindex can be used in your final report