Full Version: hiding s datasheet field
UtterAccess Forums > Microsoft® Access > Access Forms
StillLearning
Hi everyone!
Is there a way to hide a field in datasheet view because if I set Visible to No, it still appears in datasheet view. And something else than setting the size to zero by dragging the mouse if possible. There should be a property that control this but I can't find it.
Thanks!
freakazeud
Hi,
do you mean columns? You can hide/unhide columns by going to the Format menu option.
HTH
Good luck
StillLearning
This works but the user can still unhide the column with a drag of the mouse. The column size is zero but it's still there. Is there a way that the user wouldn't be able to see the column even with a mouse drag? (Apart form deleting the field of course...)
fkegley
You're not letting the users open the tables directly are you? If so, then develop forms to allow them to look at the data. Forms give you much more control over what the users can and cannot see and do to the data. For instance, you could lock the control so that a user couldn't change it yet he would still be able to see it.
StillLearning
No tables directly of course!
The control is already locked because it's from a crosstab query so no editing is possible. I just don't want it to be visible because it's a code that I use to set conditional formatting on other fields and it would be confusing for users to see it.
If there's no other way, I will hide columns with Format menu option but it would be even better to "really" hide them!
Thanks!
fkegley
I would not give any more time to this if I were you. Let it be what it is. If anyone asks, tell them.

Odid just have a thought. What about opening the form in Design View and setting the Tab Stop property of the offending control to No?


Edited by: fkegley on Wed Mar 1 15:23:17 EST 2006.
freakazeud
You could "hide" the column and then freeze it!
Another way would be to reposition the column as soon as the user tries to drag it with code.
I think this can be seen here!
HTH
Good luck
freakazeud
The user still could just drag the column heading to make the column re-appear! Doesn't matter what the tab property is like!
niesz
If you want to hide a column in datasheet view and never allow users to see it, why not just remove this field from the query?
freakazeud
Appearently beca
niesz
Then I would have to agree with Frank. Change this to a Continuous form that mimics a datasheet view and set the field's visible property to False.
StillLearning
I don't get this:
<
niesz
See attached for the differences
StillLearning
I didn't know you could do this!
Thanks!
niesz
Glad to help.
fkegley
To hide a column via code:
Me.Description.ColumnWidth = 0
in the appropriate event. For instance in the Form Load event to hide the column in the first place, the Form Resize event, the Form Double-click event. I have done it.
raweller
If all you need it for is conditional formatting, then remove the textbox from the form and reference the
field directly through the forms recordset.
CODE
  If Me.Recordset.Fields("Code") = 2 Then
    Me.txtStatus.BackColor = vbRed
  Else
    Me.txtStatus.BackColor = -2147483643 'Access's normal value for white
  End If
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.