
A site for solving at least some of your technical problems...
A site for solving at least some of your technical problems...
You may have noticed that whenever you create a Datasheet you can double click on the right edge to resize the column to the widest text currently defined in that column.
This is neat but if I create a table with 10 columns, that's work. Especially if I need to reload data in that table each time I use it, 10 times an hour. (i.e. 100 x double click would definitively kill me!)
Of course, you may not need to resize all 10 columns each time, but wouldn't it be neat to have the columns width auto-adjust with the data you put in that Datasheet table?!
I think it would be!
The solution is actually very simple. Assuming your Datasheet is defined in a Subform named DS that has 10 columns named C1 to C10 you can write:
DS.Form.C1.ColumnWidth = -2
DS.Form.C2.ColumnWidth = -2
...
DS.Form.C10.ColumnWidth = -2
This is actually defined in the documentation, but I just couldn't find it. There is nothing in the MS-Access documentation that says automatically resize columns or auto-resize or auto-size column, auto-width, column width, etc.
The fact is they do not even explain the -2 value, but they show an example with it! They only specify -1 as the default width.
There are cases when you will eventually need to resize the DAO column too. In that case you need to set the property named "ColumnWidth" on the DAO field. But frankly, that's another story altogether! You can see a sample code at the end of this post.
You like this theme?
Get it now for your
Drupal v6.x website!
The White Theme
Find the page/content you are looking for with our index.
In computing, a language is a lexicon and grammar enabling a programmer to write software. There are interpreted and compiled languages. When compiling the computer transform the instructions of a program into instructions that the processor can execute natively.