Full Version: Subform In Datasheet View: Supress Headers?auto Row Height?
UtterAccess Forums > Microsoft® Access > Access Forms
EdNerd
I have a subform presented in Datasheet view. This works well for me in presenting the data. But I have two questions about this.

(1) Can I somehow supress the default column headers? Not the labels that automatically iappear on the form - I've already deleted those. But the datasheet opens with the column names as headers. I'd rather put these in label controls on the main form. If I can't supress them, can I change them all to some empty value? (I assume they're Strings, so that would be "", yes?)

(2) Can I make each field wrap the text and automatically grow in height to fit the text? So that each row of the datasheet will expand or shrink as needed to show the text properly?

Basically, I'm trying to mimic an Excel worksheet, where typing more text in a cell can cause the row height to expand, and all the other data in the same record stays in line.

Yes, I looked at Continuous view. It maybe could do what I want, except that I still couldn't find a way to make the individual field controls grow or not to fit the text, and then have this affect the height of all the other controls from the same record. Nor could I find a way to stack all the records one on top of the other like in Datasheet view. And no searches of Google or UtterAccess turned up anything that looked to me like the answers. Not saying the answers weren't there, just that I didn't recognize them if they were.

Ed
missinglinq
QUOTE
(1) Can I somehow supress the default column headers...If I can't supress them, can I change them all to some empty value


I know of no way to suppress them, but you can set them to 'nothing.' In Design View, for the appropriate Table, select each Field, in turn, go down to the Caption Property, and enter a Space by pressing the Space Bar. When through with all Fields exit the Table, saving it when prompted. Note that you have to do this before creating the Datasheet View Form; once a Form is created, the Column Headers will remain as they were when it was created. Using this method the Column Headers will still be there, they will just be 'empty.'


QUOTE
(2) Can I make each field wrap the text and automatically grow in height to fit the text? So that each row of the datasheet will expand or shrink as needed to show the text properly?


While I'm pretty sure that, with a great deal of VBA code, you could resize the Height, realistically it would not be feasible. You would have to
  • Use a monospaced (aka fixed pitch/fixed width or non-proportional) font, in order to figure out how many lines were needed. Most people find such fonts unprofessional looking, today; the look like something that came from a printer 30 years ago.
  • Calculate the characters per Field for each Textbox as you entered it and adjust the height, accordingly


The problem with doing this, on a Datasheet View or Continuous View Form, is that, unlike the behavior you describe for Excel, every line would be formatted according to the length of data in the current Textbox, not just that one line! The height of all Records would be bobbing, continually, up and down, as you move from Control to Control!

Linq ;0)>
Peter Hibbs
Ed,

The only way you could do what you want is to use a FlexGrid control instead of the subform, see this FlexGrid Demo for some examples. Note that ActiveX controls will NOT work with the 64 bit version of Access.

Peter Hibbs.
EdNerd
Linq and Peter:

Thanks for the replies. I guess I'm stuck then. The DataSheet is built on a query, and the 'nothing' isn't working with the query. And I think we've got the 64-bit version, so the FlexGrid isn't going to work.

On we go, then ....
Ed
Peter Hibbs
Ed,

OK, on to plan B then...

How about embedding a report (which does have the option to change the control heights automatically) in the form. Of course, you would not be able to edit the text directly but you could probably provide a pop up form in which the user could enter the text and update the table and when the form closes it would need to refresh the form to show the report. I have not tried this myself but have a look THIS EARLIER POST for more info.

Peter Hibbs.
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.