referring to object on a subform or tab

G

Guest

Below, I have pasted some code that I have been using to hid fields dependent
on entries in other fields.
This works. Except in this case, the passexpiration field as well as the
passport checkbox are on a tab within a form. I am not sure if I should
handle the "me" expression to indicate a subform or tab - and in either case,
I do not know what syntax to use to achieve that.
Thanks,

Private Sub Form_Current()
Me.PassExpiration.Visible = False
Select Case Passport
Case Is = "-1"
'checked box has a value of -1

Me.PassExpiration.Visible = True
Case Else

End Select
End Sub
 
G

Guest

The Me indicate the current form where this code is located in, so the me
will be followed by the name of the object within that form.
In the TAB case, you refer to any field in it like it was on the form itself
and not like its on a sub form

Me.[FieldName on the Tab]

Unless there is a sub form on the TAB, in that case
Me.[SubFormControlName].Form![FieldNameInTheSubForm]
 
G

Guest

That is what I have. passexpiration is the object name - and it doesn't like
it.


Ofer Cohen said:
The Me indicate the current form where this code is located in, so the me
will be followed by the name of the object within that form.
In the TAB case, you refer to any field in it like it was on the form itself
and not like its on a sub form

Me.[FieldName on the Tab]

Unless there is a sub form on the TAB, in that case
Me.[SubFormControlName].Form![FieldNameInTheSubForm]

--
Good Luck
BS"D


Papa Jonah said:
Below, I have pasted some code that I have been using to hid fields dependent
on entries in other fields.
This works. Except in this case, the passexpiration field as well as the
passport checkbox are on a tab within a form. I am not sure if I should
handle the "me" expression to indicate a subform or tab - and in either case,
I do not know what syntax to use to achieve that.
Thanks,

Private Sub Form_Current()
Me.PassExpiration.Visible = False
Select Case Passport
Case Is = "-1"
'checked box has a value of -1

Me.PassExpiration.Visible = True
Case Else

End Select
End Sub
 
G

Guest

Okay - I finally got it! Thanks Ofer!

Ofer Cohen said:
The Me indicate the current form where this code is located in, so the me
will be followed by the name of the object within that form.
In the TAB case, you refer to any field in it like it was on the form itself
and not like its on a sub form

Me.[FieldName on the Tab]

Unless there is a sub form on the TAB, in that case
Me.[SubFormControlName].Form![FieldNameInTheSubForm]

--
Good Luck
BS"D


Papa Jonah said:
Below, I have pasted some code that I have been using to hid fields dependent
on entries in other fields.
This works. Except in this case, the passexpiration field as well as the
passport checkbox are on a tab within a form. I am not sure if I should
handle the "me" expression to indicate a subform or tab - and in either case,
I do not know what syntax to use to achieve that.
Thanks,

Private Sub Form_Current()
Me.PassExpiration.Visible = False
Select Case Passport
Case Is = "-1"
'checked box has a value of -1

Me.PassExpiration.Visible = True
Case Else

End Select
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top