Full Version: Bound Columns
UtterAccess Discussion Forums > Microsoft® Access > Access Reports
Tech2b
Hello everyone!

I have a question about grouping and sorting for reports. I have a report for submittals. I want the data to be grouped by spec. section. I have achieved that. The problem is that the order is alphabetical by the section name. I want the group order to be by spec section number. my section numbers and names are in the same text/combo box. the section number is in column 2 and the name is in column 3. am I asking for too much? see report attached.
argeedblu
You can refer to a combo's columns by number, comboname.columns(columnnumber - 1). Columns are actually numbered from 0-n so you have to subtract one from what you think is the column number.

Glenn
Tech2b
okay, so do I use the expression builder in the group option as follows: spec section2.columns(columnnumber-1)
argeedblu
Not quite.

You will have to base your report on a query and include a column in the query that refers to the Form and Control Name (name of the combo box). You refer to the column by number so you determine the number by subtracting 1 from the column position in the combo list when you are counting from left to right. So if you want a value from the third column, you specify 2.

Glenn
Tech2b
It looks like an expression can be used to achieve this. I am trying [Spec Section2] «Expr» [Spec Section2].BoundColumn =column(2) and I keep getting the error that I used and operand without an operator. where am I going wrong.
argeedblu
At a minimum, you would have to include the name of the object (combo box) to which the column belongs - =Name of your combo box.column(2). <<Espr>> is simply a placeholder and should be replaced with an actual expression.

Glenn
Tech2b
Hello- I am back with the problem still unresolved.

After reading back through the thread, I created a query. I selected the needed fields from the table. under the critera row for the combo box I enter the following expression =[Submittals].[Spec Section2].columns(1). When I run the query I get the error: undefined function '[Submittals].[Spec Section2].columns(1)' in expression.

question 1: Did I put the expression in the correct location?
question 2: Did I use the wrong expression or word it incorrectly?
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.