Results 1 to 8 of 8
  1. #1
    Join Date
    Sep 2003
    Location
    Raleigh, NC
    Posts
    183

    Exclamation Unanswered: Using one form in diff way

    How can i make cmd button on my form visible or invible based on where the form was open ?

    Ex: I have "frmSearch" if this form is open frm the Switchboard then i would to hide "cmdCancel" which is on the "frmSearch" if the "frmSearch" is open from the "frmMain" then i would like "cmdCancle to be visible.

    Thanks in advance
    Skharva

  2. #2
    Join Date
    Apr 2004
    Location
    South Arica
    Posts
    125
    You could try declaring a global, static variable. in the click event on "frmMain", set the variable to "True", and in the click event on the switchboard, set the variable to false. Then in the "form_Open" event on "frmSearch", check the state of the varible.

    cmdCancel.Visible=blnVisible

  3. #3
    Join Date
    Sep 2003
    Location
    Raleigh, NC
    Posts
    183
    Originally posted by Saila
    You could try declaring a global, static variable. in the click event on "frmMain", set the variable to "True", and in the click event on the switchboard, set the variable to false. Then in the "form_Open" event on "frmSearch", check the state of the varible.

    cmdCancel.Visible=blnVisible
    Do you have any example of this ? Also, i i have "cmdNew" on my main form which i would like to make it disable or invisible when the "frmMain" is open from SwithBoard.
    Skharva

  4. #4
    Join Date
    Apr 2004
    Location
    South Arica
    Posts
    125
    I don't have an example at the moment, I can put one together if you like. What exactly would you like it to do?

    If "frmSearch" is opened from switchboard, "cmdCancel" Invisible.
    If "frmSearch" is opened from "frmMain", "cmdCancel" Visible.

    Is there anything else?

  5. #5
    Join Date
    Apr 2004
    Location
    South Arica
    Posts
    125
    This example file is very simple, there are three forms, with one button on each. I changed the way it was done, should be easier to use. In the click event of the Open button, Open "frmSearch", and then set the enabled/visible property of "cmdCancel" as required.

    Let me know if this isn't what you were looking for.
    Attached Files Attached Files

  6. #6
    Join Date
    Sep 2003
    Location
    Raleigh, NC
    Posts
    183

    Thumbs up

    Originally posted by Saila
    This example file is very simple, there are three forms, with one button on each. I changed the way it was done, should be easier to use. In the click event of the Open button, Open "frmSearch", and then set the enabled/visible property of "cmdCancel" as required.

    Let me know if this isn't what you were looking for.
    Thanks that helps alot
    Skharva

  7. #7
    Join Date
    Sep 2003
    Location
    Raleigh, NC
    Posts
    183
    Originally posted by Skharva
    Thanks that helps alot
    One more question regading using same form for two purpose. I have "frmMain" when this form is open from SwitchBoard the "cmdNew" is disable. How can i make "cmdNew" enable once user have input first record ?
    Skharva

  8. #8
    Join Date
    Apr 2004
    Location
    South Arica
    Posts
    125
    you can either use the after_update event of each text box on your form;

    text1_After_Update
    cmdNew.enabled=true
    end sub

    or the dirty event of the form, with the same line of code.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •