Sort Column

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form with several columns. Each column has a button the user clicks
to sort the form. I have the orderby for each column, this works great.
However; I have two columns that reference another field's column number.
Example:
Column A has [Project]
Column B has [Project].[column](1)
Column C has [Project].[column](2)
How can I sort on column B or C with code.
The information for columns B and C are not really stored in the form. They
are located in the RowSource for Column A.

Please help, I am at a loss on this one.
 
France,

I am pretty sure you won't be able to do this with your existing design.
I think you may need to forget the Column() thing, and instead base
the form on a query that includes the table that serves as the Row
Source of the Project combobox. Then you will have Columns B and C
directly bound to fields in the form's Record Source query, and should
then be able to sort on them.
 
Thank you for responding to my question.
I tried to base it on a query with the Project table but then I couldn't
update the information on the form.

My thought was that I couldn't sort on it because the information is not
really on the form. I will have to re-design my database if I want to sort
by those two columns.

Thanks again
--
Thank you and have a great day!
France


Steve Schapel said:
France,

I am pretty sure you won't be able to do this with your existing design.
I think you may need to forget the Column() thing, and instead base
the form on a query that includes the table that serves as the Row
Source of the Project combobox. Then you will have Columns B and C
directly bound to fields in the form's Record Source query, and should
then be able to sort on them.

--
Steve Schapel, Microsoft Access MVP
I have a form with several columns. Each column has a button the user clicks
to sort the form. I have the orderby for each column, this works great.
However; I have two columns that reference another field's column number.
Example:
Column A has [Project]
Column B has [Project].[column](1)
Column C has [Project].[column](2)
How can I sort on column B or C with code.
The information for columns B and C are not really stored in the form. They
are located in the RowSource for Column A.

Please help, I am at a loss on this one.
 
France,

Ok, whether the query is updateable or not does depend on the structure
of the tables and the structure of the query.

Another option, instead of putting the Project table right into the
query itself, is to make a couple of calculated fields in the query,
using a DLookup() function. That will not make the query
non-updateable, and will allow the Column B and C controls on the form
to be bound to query columns. If your form contains a very large number
of records, two DLookup's might make the query a bit sluggish, but
otherwise should be fine.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top