Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run-time error '94' using CTRL + ' (Apostrophe) 1

Status
Not open for further replies.

BobJacksonNCI

Technical User
Mar 11, 2003
725
US
TIA,

I'll probably figure out a workaround, but am posting for feedback and because this may be annoying others.

I have a drop-down combo box that is populated by a Select statement. If I enter a record and then try to duplicate an entry in a subsequent record using the shortcut key of Control + Apostrophe, I get:
Run-time error '94' Invalid use of Null

Has someone else run into this and resolved it so the shortcut key can be used?

Alternately, what is the character code for Control + Apostrophe. Or, how can I figure it out...

With that information, I can disable it using:

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
Case ??
KeyCode = 0
End Select

Your assistance IS appreciated!
Bob
 
Hi!

[tt]if keycode=39 and _
(shift and acCtrlMask)<>0 then[/tt]

Should trap for the combination (in my version it's 191, but 39 seems to be the usual keycode for apostrophe, might be some "regional" keycodes?).

To find it, you could do a debug.print keycode to get the correct number

Roy-Vidar
 
Thanks for assisting, Roy!

For the possible benefit to others, here's what I have:

FOLLOWING CAUSES DROP-DOWN TO AUTOMATICALLY OPEN

Private Sub cboTypeOfHours_GotFocus()
cboTypeOfHours.Dropdown
End Sub


FOLLOWING TRAPS AS SOON AS CTRL IS PRESSED

Private Sub cboTypeOfHours_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 17 Then
MsgBox "I'm sorry, but CTRL + Apostrophe cannot be used with type of hours", vbOKOnly, "CTRL + ' NOT AVAILABLE"
DoCmd.CancelEvent
End If
End Sub

ADDITIONAL NOTES:
I believe the problem actually occurs because the combo box is based on selection from a table containing multiple fields.



HTH,
Bob [morning]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top