Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!
  1. Guest ji, please consider donating today!
      Become a Supporter    ::   Make a Contribution   
    Monthly Recurring Target: $300 :: Achieved: $95

Which form event would I use?

Discussion in 'Information Technology' started by Ricter, Jul 28, 2006.

  1. Ricter

    Ricter
    Expand Collapse
    Guest

    I want to make control1 on my form not visible if control2 = X. I have this
    code in the Exit event of control2. Additionally, I am also carrying forward
    the value of Control2 to new records. This works fine until I begin cycling
    through records without exiting control2. Of course when I do that, the last
    state of control2 when it was exited is applying to all records.

    I believe I need to attach my code to the form, so that when I cycle through
    records, control2 is looked at and control1 is visible, or not.

    What I don't know is what form event do I use?
     
  2. Loading...


  3. fredg

    fredg
    Expand Collapse
    Guest

    On Fri, 12 May 2006 10:35:02 -0700, Ricter wrote:

    > I want to make control1 on my form not visible if control2 = X. I have this
    > code in the Exit event of control2. Additionally, I am also carrying forward
    > the value of Control2 to new records. This works fine until I begin cycling
    > through records without exiting control2. Of course when I do that, the last
    > state of control2 when it was exited is applying to all records.
    >
    > I believe I need to attach my code to the form, so that when I cycle through
    > records, control2 is looked at and control1 is visible, or not.
    >
    > What I don't know is what form event do I use?


    A better event than the Exit event would be the AfterUpdate event.
    Anyway place the same code in the Form's Current event:

    Me![Control1].Visible = Me![Control2] = X

    (if X is a number, or ="X" if X is Text)
    --
    Fred
    Please respond only to this newsgroup.
    I do not reply to personal e-mail
     
  4. freakazeud

    freakazeud
    Expand Collapse
    Guest

    Hi,
    use the form's on current event!
    HTH
    Good luck
    --
    Oliver
    Admin Specialist & Computer Science Major @ UMD - Go Terps - :)
    http://www.oli-s.de


    "Ricter" wrote:

    > I want to make control1 on my form not visible if control2 = X. I have this
    > code in the Exit event of control2. Additionally, I am also carrying forward
    > the value of Control2 to new records. This works fine until I begin cycling
    > through records without exiting control2. Of course when I do that, the last
    > state of control2 when it was exited is applying to all records.
    >
    > I believe I need to attach my code to the form, so that when I cycle through
    > records, control2 is looked at and control1 is visible, or not.
    >
    > What I don't know is what form event do I use?
    >
    >
     
  5. Ricter

    Ricter
    Expand Collapse
    Guest

    Nice, I didn't know you could use this syntax:
    Me![Control1].Visible = Me![Control2] = X

    I'm presently using an If Then statement.

    There are actually three values of Control2 that should set Control1 to not
    visible. Could I then use:
    Me![Control1].Visible = Me![Control2] = X Or Me![Control2] = Y Or
    Me![Control2] = Z

    ?

    "fredg" wrote:

    > On Fri, 12 May 2006 10:35:02 -0700, Ricter wrote:
    >
    > > I want to make control1 on my form not visible if control2 = X. I have this
    > > code in the Exit event of control2. Additionally, I am also carrying forward
    > > the value of Control2 to new records. This works fine until I begin cycling
    > > through records without exiting control2. Of course when I do that, the last
    > > state of control2 when it was exited is applying to all records.
    > >
    > > I believe I need to attach my code to the form, so that when I cycle through
    > > records, control2 is looked at and control1 is visible, or not.
    > >
    > > What I don't know is what form event do I use?

    >
    > A better event than the Exit event would be the AfterUpdate event.
    > Anyway place the same code in the Form's Current event:
    >
    > Me![Control1].Visible = Me![Control2] = X
    >
    > (if X is a number, or ="X" if X is Text)
    > --
    > Fred
    > Please respond only to this newsgroup.
    > I do not reply to personal e-mail
    >
     
Since you're here... we have a small favor to ask...

More people are visiting & reading SPN than ever but far fewer are paying to sustain it. Advertising revenues across the online media have fallen fast. So you can see why we need to ask for your help. Donating to SPN's is vote for free speech, for diversity of opinions, for the right of the people to stand up to religious bigotry. Without any affiliation to any organization, this constant struggle takes a lot of hard work to sustain as we entirely depend on the contributions of our esteemed writers/readers. We do it because we believe our perspective matters – because it might well be your perspective, too... Fund our efforts and together we can keep the world informed about the real Sikh Sikhi Sikhism. If everyone who writes or reads our content, who likes it, helps us to pay for it, our future would be much more secure. Every Contribution Matters, Contribute Generously!

    Become a Supporter      ::     Make a Contribution     



Share This Page