Re: Hiding A Field

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



On Feb 17, 6:09 pm, fredg <fgutk...@xxxxxxxxxxxxxxx> wrote:
On 17 Feb 2007 14:23:15 -0800, Jim wrote:





On Feb 17, 3:49 pm, fredg <fgutk...@xxxxxxxxxxxxxxx> wrote:
On 17 Feb 2007 12:20:50 -0800, Jim wrote:

On Feb 17, 3:15 pm, "Jim" <jim.be...@xxxxxxxxx> wrote:
I'm trying to have a field trigger another field's presence. I have a
field that holds a Y or N. I need for when it show N to not show the
field below it and otherwise to show all the fields.

A screenshot of the undesired producct can be obtained from me if you
have questions.

I forgot to mention the coding I have done ...

Private Sub HideBox()
'set focus on the InAContainer field aka if it is in a container
Me.InAContainer.SetFocus
'then test for results and make field invisible if it says no
If Me.InAContainer.Text = "N" Then
Me.EqContainerStoredIn.Visible = False
Else
Me.EqContainerStoredIn.Visible = True
End If
End Sub

Private Sub Form_Load()
Call HideBox
End Sub

This is in Access 2000 too. I'm not all caught up on my office
software.

Code the Form's Current event.

Me![EqContainerStoredIn].Visible = Me![InAContainer] = "Y"

Place the same code in the [InAContainer] control's AfterUpdate event.

--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail- Hide quoted text -

- Show quoted text -

Well ... it doesn't want to evaluate that code. At least that what's
the error code says.

Well ....
Me![EqContainerStoredIn].Visible can be either True or False.
Me![InAContainer] = "Y" can be either True or False.

So, [EqContainerStoredIn].Visible will be True or False depending upon
whether the statement [InAContainer] = "Y" is True or False.

If Access cannot evaluate that, then you have something else going on
that is not evident in your message.

You're welcome to go back to your other If .. Then expression if that
helps you, as long as you place it in the Form's Current event and in
the [InAContainer] AfterUpdate event.
Also, it's not the control's Text property you need to check, it's the
Value property. Since Value is the default property you do not need to
state it.

If Me.InAContainer = "N" Then
Me.EqContainerStoredIn.Visible = False
Else
Me.EqContainerStoredIn.Visible = True
End If

--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail- Hide quoted text -

- Show quoted text -

Ok I plugged in the code you gave me and it gave me an error message.

It goes as follows:
The expression On Current you entered as the event property setting
produced the following error: Procedure declaration does not match
description of event or procedure having the same name.

* The expression may result in the name of a macro, the name of a user-
definition, or [Event Procedure].
* There may have been an error evalulating the function, event, or
macro.

I also have buttons (done by wizard) for navigation and other
operations.

.



Relevant Pages

  • Re: A Question for all of you Macro Gurus
    ... What does the error message say? ... >> purposes of the following macro. ... >> Please reply to the newsgroup unless you wish to avail yourself of my ... >> services on a paid consulting basis. ...
    (microsoft.public.word.mailmerge.fields)
  • Re: compile error message
    ... the 'all ' category under look in and that macro that is ... causing all the trouble and the compile error message ... >> my normal template, which has much in it that I don't ... >> to the newsgroup so ...
    (microsoft.public.word.newusers)
  • Re: adding a file attachment to an email merge?
    ... I copy/pasted the macro but when I run it I get an error message. ... > Please respond to the Newsgroup for the benefit of others who may be ... > Doug Robbins - Word MVP ...
    (microsoft.public.word.mailmerge.fields)
  • Re: Creating and Removing Watermark via VBA?
    ... > I tried recording a macro for this but it fails when running it. ... And indicate on which line it failed, plus the error message. ... This reply is posted in the Newsgroup; ...
    (microsoft.public.word.vba.beginners)
  • Re: Error Codes
    ... Use the following newsgroup for questions or problems with Networking ... full error message when posting there. ... > I have an error code when accessing the Internet (Code ... Checked Phone still to no avail. ...
    (microsoft.public.internet.mail)