ColumnWidth in flag

Ruslan1

New member
Local time
Yesterday, 19:36
Joined
Apr 29, 2014
Messages
7
Hello, how to implement the procedure of clicking on the flag and hide the field in VBA? I know that want to assign - ColumnWidth=0.
Сomplete procedure fails. please help : Banghead:
 
You can change the Visibility property of things in VBA. So in the 'OnClick' event of the thing being clicked on, write.

Me.[ThingToHide].Visibility = False

Hopefully this is what you were getting at.
 
Thanks for answer, but it is not, it is necessary that the field has shifted to the left or cleaned at all. It is necessary to remove the extra fields when printing, which are not included in the print margins.
 
Not 100% sure what you are trying to do. Things you have set to not be visible in the way I suggested will not show up when printing, if that was your concern.
 
Here's a picture h ttp:// oi60.tinypic.com/2ykx4ly . jpg
it is necessary that after clicking on the flag moved to the left
h tt p: // oi60.tinypic.com/2hz1my9 . jpg
so I asked about ColumnWidth
 
Ah I see what you mean now. Well perhaps the thing to try is just reducing column widths to small but non-zero amounts. Like set them to 0.1, which Access might allow you to do. If its small enough it will just look like a little line when you print it, so should be almost as if it's not there at all.
 
Yes, that's through the VBA fails

Sub Flag43_Click()
Me.Field.ColumnWidth = 0.1
End Sub
Code doesn't work
 
Having looked at this page:

http://msdn.microsoft.com/en-us/library/office/aa224081(v=office.11).aspx

it looks like you should try something along the lines of

Code:
Forms![FormName].[Subformname].Form![FieldName].ColumnWidth=0
(assuming your data is a datasheet view form that is a subform of your main form, which is what is vaguely looked like from your picture earlier.

When you say "Code doesn't work", that doesn't really help. Need to know what error messages appeared if any, and which line of the code caused the error. Otherwise you'll be better off just googling the solution rather than asking for specific help on a forum
 
It's not subform, it's - continuous form

Sorry, I'm just learning more.
Thanks.
 
It's not subform, it's - continuous form

Sorry, I'm just learning more.
Thanks.

Ah okay, in that case the .ColumnWidth won't work, as I think it only works on datasheet view forms. For a continuous form I would recommend the .Visible method. Maybe try:

Code:
Forms![FormName]![FieldName].Visible = False
As It might have been something to do with the Me. part of the code used before that was stopping it work. It should work, as I've done this sort of things to fields countless times.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom