Results 1 to 5 of 5
  1. #1
    5 Star Lounger bfxtrfcmgr's Avatar
    Join Date
    Aug 2002
    Location
    Fresno, California, USA
    Posts
    995
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Close form on 'Enter' (2002 SP-2)

    Due to numerous "On Not in List" conditions on a form, I have several single txtbx forms to provide the info for the Not in List data. In order to avoid unnecessary keyboard/mouse movements, is there a way to just hit "Enter" to close a form? I have been using <img src=/S/blush.gif border=0 alt=blush width=15 height=15> Tab/Enter to tab out of the txtbx to a cmdbtn with a close function.
    Bryan,
    Not the smartest critter on the glacier. . .
    . . .but I'm persistent (does that count?)

  2. #2
    Gold Lounger
    Join Date
    Feb 2004
    Location
    Cape Town, RSA
    Posts
    3,444
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Close form on 'Enter' (2002 SP-2)

    if you change the command button "Default" property to True, you can enter and the command button event should fire which should close the form. The same way you can change the Cancel buttons Cancel property to True which allows you to escape to close the form, as long as you have the code in the On click event!
    Regards,
    Rudi

  3. #3
    5 Star Lounger bfxtrfcmgr's Avatar
    Join Date
    Aug 2002
    Location
    Fresno, California, USA
    Posts
    995
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Re: Close form on 'Enter' (2002 SP-2)

    Hmm. . .not sure I follow. The form opens with the txtbx having focus; hitting "Return" does nothing. Hitting Tab (focus on cmdbtn) then Return is what I have now. Changing the default property ('Other' tab) to "yes" doesn't change anything. The code for the cmdbtn is simply DoCmd.Close

    EDIT: Well, I see the problem now; the answer was too obvious for me to take notice. <img src=/S/dizzy.gif border=0 alt=dizzy width=15 height=15> In the After Update event of the txtbx just use the DoCmd.Close code. This completely eliminates the need for the cmdbtn.
    Bryan,
    Not the smartest critter on the glacier. . .
    . . .but I'm persistent (does that count?)

  4. #4
    Gold Lounger
    Join Date
    Feb 2004
    Location
    Cape Town, RSA
    Posts
    3,444
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Close form on 'Enter' (2002 SP-2)

    <P ID="edit" class=small>(Edited by RudiS on 18-Oct-04 08:48. Heres the attachment...forgot to add it!)</P>I'm glad you were able to sort out your problem.
    I took the liberty to attach a sample DB to illustrate the Default and Cancel properties of a Command button!
    If you open the attached DB, open the Product Form and press ENTER or ESCAPE. You will notice that the form closes, irrespective of where the cursor is. All I did was change the OK buttons default property to Yes, and the Cancel buttons Cancel property to Yes.
    Regards,
    Rudi

  5. #5
    5 Star Lounger bfxtrfcmgr's Avatar
    Join Date
    Aug 2002
    Location
    Fresno, California, USA
    Posts
    995
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Re: Close form on 'Enter' (2002 SP-2)

    Thanks Rudi; I appreciate the assist, as well as the example.
    Bryan,
    Not the smartest critter on the glacier. . .
    . . .but I'm persistent (does that count?)

Posting Permissions

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