Access 2003 Key



The code worked fine in XP but in WIndows 7 it does not. I need a fix desperately for Access 2003 on Windows 7 for Send Keys. This is VBA Sub MySendKeys(SendText As String, Optional WaitResponse As Boolean = False) 'wrapper for Sendkeys which does not crash in the IDE under Windows Vista Set WshShell = CreateObject('WScript.Shel l') VBA. Question: In Microsoft Access 2003/XP/2000/97, how do you disable the Esc key in an Access form? Answer: To disable the Esc key in an Access form, open your form in design view. Set the form's property called 'Key Preview' to Yes. Then select the property called 'On Key Down' and click on the button with the three dots to the right.

This MSAccess tutorial explains how to re-enable the shift key when logging into a secure database in Access 2003 (with step-by-step instructions).

Question: In Microsoft Access 2003/XP/2000/97, how can I re-enable the Shift key when a user logs in so that the Database window becomes visible?

I've secured a database using the User-Level Security Wizard and I've also hidden the Database window in the Startup Options for the database. However, when a user logs in while holding down the Shift key, the Startup Options are not bypassed and so the Database window will not appear.

Answer: Within your Access database, there is a Database Property called 'AllowBypassKey'. By default, your Access database sets this property to True and allows users to use the Shift key functionality when logging into a secured database.

If you are unable to use the Shift key to bypass the Startup Options and display the Database window, the 'AllowBypassKey' property has been set to False and you need to change it back to True.

To do this, you need to run the following VBA code:

You only need to run this code once and your database will re-enable the Shift key from that point on - even if the Access database is shutdown and restarted.

Just make sure that when you run the code, you have Administrator privileges to the database.

Tip: You may want to create a button on a form that allows you to enable or disable the Shift key. You can make the button visible to only certain users with the CurrentUser function.

2003

If after trying this example, you receive a 'not defined' error on the 'Dim db as DAO.Database' declaration, you will need to follow some additional instructions.

-->

The KeyUp event occurs when the user releases a key while a form or control has the focus. This event also occurs if you send a keystroke to a form or control by using the SendKeys action in a macro or the SendKeys statement in Visual Basic.

Private Sub object_KeyUp(KeyCode As Integer, Shift As Integer)

Object The name of a Form or control on a Form.

KeyCode A key code, such as vbKeyF1 (the F1 key) or vbKeyHome (the HOME key). To specify key codes, use the intrinsic constants shown in the Object Browser. You can prevent an object from receiving a keystroke by setting KeyCode to 0.

Shift The state of the SHIFT, CTRL, and ALT keys at the time of the event. If you need to test for the Shift argument, you can use one of the following intrinsic constants as bit masks:

Remarks

Note The KeyUp event applies only to forms and controls on a form, not controls on a report.

To run a macro or event procedure when these events occur, set the OnKeyUp property to the name of the macro or to [Event Procedure].

For this event, the object with the focus receives all keystrokes. A form can have the focus only if it has no controls or all its visible controls are disabled.

A form will also receive all keyboard events, even those that occur for controls, if you set the KeyPreview property of the form to Yes. With this property setting, all keyboard events occur first for the form, and then for the control that has the focus. You can respond to specific keys pressed in the form, regardless of which control has the focus. For example, you may want the key combination CTRL+X to always perform the same action on a form.

If you press and hold down a key, the KeyDown and KeyPress events alternate repeatedly (KeyDown, KeyPress, KeyDown, KeyPress, and so on) until you release the key, then the KeyUp event occurs.

Although the KeyUp event occurs when most keys are pressed, they are typically used to recognize or distinguish between:

Access
  • Extended character keys, such as function keys.

  • Navigation keys, such as HOME, END, PAGE UP, PAGE DOWN, UP ARROW, DOWN ARROW, RIGHT ARROW, LEFT ARROW, and TAB.

  • Combinations of keys and standard keyboard modifiers (SHIFT, CTRL, or ALT keys).

  • The numeric keypad and keyboard number keys.

The KeyUp event does not occur when you press:

  • The ENTER key if the form has a command button for which the Default property is set to Yes.

  • The ESC key if the form has a command button for which the Cancel property is set to Yes.

Key

Tip

The KeyUp event occurs after any event for a control caused by pressing or sending the key. If a keystroke causes the focus to move from one control to another control, the KeyDown event occurs for the first control, while the KeyPress and KeyUp events occur for the second control.

For more information, see Order of events for keystrokes and mouse clicks .

If a modal dialog box is displayed as a result of pressing or sending a key, the KeyDown and KeyPress events occur, but the KeyUp event doesn't occur.

Macro

You can use a KeyDown or KeyUp macro to respond whenever the user presses or releases a key while a form or control has the focus. However, macros can't return the key code and determine which key was pressed, so you typically use event procedures with these events.

You can't use the CancelEvent action in a KeyDown or KeyUp macro.

Microsoft Access 2003 Download

Applies to | BoundObjectFrame Object | CheckBox Object | ComboBox Object | CommandButton Object | Form Object | ListBox Object | OptionButton Object | TabControl Collection | TextBox Object | ToggleButton Object

Access 2003 Help

Key

See Also | KeyDown Event | OnKeyDown Property | OnKeyUp Property