A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Problem with ComboBoxes



 
 
Thread Tools Display Modes
  #1  
Old August 25th, 2004, 02:22 AM
John S. Ford, MD
external usenet poster
 
Posts: n/a
Default Problem with ComboBoxes

I am working with Access 97 and have a form with a ComboBox (cboFirst), a
TabControl and a ComboBox (cboSecond) on the first tab. I also have a
"Sentinel CommandButton (cmdSentinel) between cboFirst and the TabControl.
The tab order of these controls is cboFirst, cmdSentinal, TabControl,
cboSecond and my goal is two-fold:

1) Have my user to be able to tab (or hit return) thereby navigating from
cboFirst to cboSecond with just the keyboard. This would save the user from
mouse-clicking while entering data.

2) Have cboSecond "dropdown" as soon as it receives the focus.

You can't tab or return "directly" from a control on the form to a control
residing on a tab so I'm using cmdSentinel as a intermediate control (a
Sentinel control) as documented in the book "Access 97 Expert Solutions"
with the following code:


Private Sub cmdSentinel_Enter()
cboSecond.SetFocus
End Sub

Private Sub cboSecond_GotFocus()
Me!cboSecond.Dropdown
End Sub


Goal 1) works perfectly. But unfortunately, cboSecond drops down for only
an instant and then closes on its own. Any idea why this happens?

John


  #2  
Old August 25th, 2004, 04:03 AM
Graham Mandeno
external usenet poster
 
Posts: n/a
Default

Hi John

I have no idea why this happens but, you're right, it's the same for me.

Perhaps you could use the KeyPress event of cboFirst:

Private Sub cboFirst_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyTab Or KeyCode = vbKeyReturn Then
cboSecond.SetFocus
KeyCode = 0
End If
End Sub

It seems to work, and it's a lot cleaner because you can do away with the
kludgey command button.
--
Good Luck!

Graham Mandeno [Access MVP]
Auckland, New Zealand

"John S. Ford, MD" wrote in message
...
I am working with Access 97 and have a form with a ComboBox (cboFirst), a
TabControl and a ComboBox (cboSecond) on the first tab. I also have a
"Sentinel CommandButton (cmdSentinel) between cboFirst and the TabControl.
The tab order of these controls is cboFirst, cmdSentinal, TabControl,
cboSecond and my goal is two-fold:

1) Have my user to be able to tab (or hit return) thereby navigating

from
cboFirst to cboSecond with just the keyboard. This would save the user

from
mouse-clicking while entering data.

2) Have cboSecond "dropdown" as soon as it receives the focus.

You can't tab or return "directly" from a control on the form to a

control
residing on a tab so I'm using cmdSentinel as a intermediate control (a
Sentinel control) as documented in the book "Access 97 Expert Solutions"
with the following code:


Private Sub cmdSentinel_Enter()
cboSecond.SetFocus
End Sub

Private Sub cboSecond_GotFocus()
Me!cboSecond.Dropdown
End Sub


Goal 1) works perfectly. But unfortunately, cboSecond drops down for only
an instant and then closes on its own. Any idea why this happens?

John




 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Big Problem. We need the fix Captain K Calendar 0 July 8th, 2004 04:50 PM
Passport Logout Problem Chen qiang New Users 0 May 4th, 2004 09:26 AM
Help Microsoft? WORD11.ADM File Problem Line 818? Dwight Hutchinson New Users 2 May 3rd, 2004 08:25 PM
Word 2000 footnote problem: footnotes consistently too high (again) Lori Formatting Long Documents 2 May 1st, 2004 07:15 PM


All times are GMT +1. The time now is 02:17 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.