Welcome to SPN

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

Sign Up Now!

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
    >
     

Share This Page