Microsoft Access Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseMicrosoft Access Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old November 7th, 2003, 02:01 PM
nakedbamboo nakedbamboo is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 2 nakedbamboo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Making a selection from a combo box.

I have a combo box where the user chooses the state. I would like to have it act like the combo box everyone is familiar with where if you hit the same letter, it cycles through the choices in that letter. For example, if I hit "O" twice I want it to cycle to Oklahoma instead of typing "OO" in the box, or if I hit it one more time, I want it to cycle to Oregon. How would I go about doing this in my combo box? Thanks.

Reply With Quote
  #2  
Old November 10th, 2003, 11:00 PM
sbaxter sbaxter is offline
Moderator: Access, SQL
ASP Free God (5000 - 5499 posts)
 
Join Date: Oct 2003
Posts: 5,126 sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 1 h 2 m 51 sec
Reputation Power: 12
I don't believe that it is possible with the standard Access ComboBox to do what you are asking. If you find someone who can show you how to do this I would appreciate you posting that information here, as i am interested.

S-

Reply With Quote
  #3  
Old November 12th, 2003, 04:19 PM
nakedbamboo nakedbamboo is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 2 nakedbamboo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Here's the Solution

The following code is in my KeyDown function of a combobox named State. The combobox has two columns (ID, Name). This is the link where I got the info to give the other guy credit.

URL


Code:
Dim CurItem as Long, LastItem as Long, I as Long

CurItem = Me.State.ListIndex
LastItem = Me.State.ListCount - 1
If CurItem < LastItem Then
    For I = CurItem + 1 To LastItem Step 1
        If UCase(Left(State.Column(1,I),1)) = UCase(Chr(KeyCode)) Then
            Me.State.ListIndex = I
            Exit For
        End If
    Next I
End If
If Me.State.ListIndex = CurItem Then
    For I = 0 to CurItem
        If Left(Me.State.Column(1,I),1) = UCase(Chr(KeyCode)) Then
            Me.State.ListIndex = I
            Exit For
        End If
    Next I
End If
If State.ListIndex = CurItem Then
    'Opps, we didn't find a match.
End If
'This will force the entry from not entering the letter in the textbox of the combobox.
KeyCode = 0

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseMicrosoft Access Help > Making a selection from a combo box.


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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 On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway