simple VB problem !!!

Posted on 2003-02-25
Medium Priority
Last Modified: 2010-05-01
VB has Date Picker Control
For Date Inputs....right

problem is that
i want Enter Key
to be used
intstead of the
default TAB key
for Focusing a control

Private Sub Form_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then
  SendKeys vbTab
End If

End Sub

the above code work well
in all type of contols
but fails to respond
for Date Picker Control

if you have any clue
plz share

Question by:aejaz
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 18

Accepted Solution

Sethi earned 40 total points
ID: 8023013
Many ActiveX control do not recognize the keypress events event if the forms Keypreview property is set to True. Write the same code in keypress event of the DateControl also. Example:
Private Sub DateControl_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
 SendKeys vbTab
End If
End Sub

Expert Comment

ID: 8031483
Well, to set the focus to the date thing, just use setfocus:


that's it!

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month10 days, 11 hours left to enroll

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question