I am attempting to build a report which uses a crosstab query as its record source. The column heading is an ID field which is dynamically refreshed based on names selected in a list box.

Basically, when names are added to a list box, an append query puts that data in a separate table that assigns an autonumber. That autonumber serves as the ID. (Each time the report is run, the table is replaced with a blank table so the autonumber begins at 1 again.)

I am trying to have a report which allows for a different number of names. (E.G. I may have 2 names in the report, so [1] and [2] would pull data.) But I want the report to be able to have [3], [4], [5], etc. However, if these fields don't exist, then I get an "Access does not recognize [3] as a valid field" error.

Is there any code I can place in VB to allow this error and still run the report?



-Shingo