CLOSE POP UP DATASHEET FORM BY PRESSING ENTER

B

BillyRogers

I have a pop up form in datasheet view. I would like the users to be able to
close the pop up by pressing enter on the keyboard. Since I can't place any
buttons on the form, I can't use the default property. Is there another way
to do this?

thanks,
Billy
 
M

MacDermott

I don't really recommend this, because you'll be teaching your users to
expect something other than the standard Access behavior (pressing enter in
datasheet view moves to the next column), but here's how you can do it:
On the Form's Property Sheet, set KeyPreview to True.
Add this code to the form's KeyDown event procedure:
If KeyCode=13 then DoCmd.Close
 
B

BillyRogers

Thanks for the help. All the fields are locked on this form, strictly read
only and it's mostly just for my use.
 
M

MacDermott

Hope it worked for you

BillyRogers said:
Thanks for the help. All the fields are locked on this form, strictly read
only and it's mostly just for my use.
 
Top