Unable to hide/show controls by clicking on datasheet of split for

  • Thread starter Thread starter Abbas
  • Start date Start date
A

Abbas

Hello,

I am having problem with hiding/showing controls (such as command buttons
and subforms), using the OnClick event of a text field of the datasheet part
of a Split Form (Access 2007); it goes through the OnClick Event Procedure
but ignores the obj.Visible = True (or False) command line, with no errors.
However, it works fine when I click on the corresponding textbox on the body
part of the Form!!

Any ideas? Thanks in advance.

Abbas
 
PLEASE HELP! This is my first post and I really hope someone can help me with this please, I spent two days trawling the internet and trying different methods to get this to work. Im not sure if its my lack of knowledge or whether its just MS Access that is at fault.

I am pretty new to VBA and I am having the same problem of hiding and un-hiding columns on a datasheet of a split form. I am building a system that will be used in front of customer and therefore wish to hide columns that contain cost sensitive data. The same forms need to be able to show the Sales Rep the hidden columns simply by ticking a box. Basically a toggle on and off of hidden columns.

I have been playing around with the code below (which i found in another forum) to hide the Field called COO when I click the tick box called chkHIdeFields check box. This works on a Single form but not on a datasheet of a split form.

Private Sub chkHideFields_Click()
' Note: vbTrue = -1
If Me.chkHideFields = vbTrue Then
Me.COO.Visible = True
Else: Me.COO.Visible = False
End If
End Sub

I have been able to hide the column of my split form by using the ColumnHidden property of the On Load event just as a proof of concept that the ColumnHidden property actually works to hide a column, which it does. This is the code that im using to hide the column called COO.

Me.COO.ColumnHidden = True

However if I then set it to = False and then close and open the form, it doesn't unhide the column. the only way I can unhide the column is to do it from the Form view via the un-hide dialogue pop up box.

i have two issues here, the first one is getting the form to recognize when to hide and when to show the column of the datasheet on the split form and the second is to get the code to for the check box method.

Lastly once I get it working for 1 field I need to be able to define a list of 7 or 8 other fields all at the same time.

I have tried to upload a small access database containing everything Ive tried but it wont let me upload so if someone can help me and would like my Access db please advise how I can supply this to you.
 
Back
Top