Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #11 (permalink)  
Old June 6th, 2005, 08:02 AM
Authorized User
 
Join Date: Jun 2005
Location: , , .
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I'm sorry, one more thing. Is there any event for when the user clicks on the arrow(I don't see one). I want the whole thing to be queried then so that in the begining it's not blank and so that later when a user clicks on it it doesn't only display T or whatever was last queried.
I guess if nothing else, I can put a button on top of it and make a look like the arrow...

Reply With Quote
  #12 (permalink)  
Old June 6th, 2005, 08:57 AM
Friend of Wrox
 
Join Date: Nov 2004
Location: Seattle, WA, .
Posts: 248
Thanks: 0
Thanked 0 Times in 0 Posts
Default

When it requeries, the next thing is supposed to be setting the SelStart and SelLength. This is supposed to put the cursor after the "P" (the first letter) and select the rest of the text. I got the impression this worked in your first test. If it is not working on your larger form it may be that the requery is taking more time (and other events are occuring) while you execute setting SelStart and SelLength. By the time the requery has actually finished, your SelStart and SelLength were set but the requery resets the values.

One thing that may help is to put a DoEvents statement in after your requery. DoEvents causes your code to "wait" while everything else (in all of Windows, not just Access) has a chance to do what they need to do. Be aware that it doesn't actually "wait". It releases control to "allow" other things to happen. But the other things have to want to happen at the instance the DoEvents is executed. You may want to execute DoEvents several times in a row to make sure everything else is done before you set SelStart and SelLength. This will slow the process down a little. But maybe not by as much as when you have all of the names in the list.

I'm not aware of an event that monitors when someone clicks the dropdown (the arrow). I'm assuming the trouble is that you don't have a RowSource until the user presses a letter. Two possible solutions for your situation... Use the GotFocus event. This will work if they click the dropdown without tabbing to the field. However, that event also executes if they tab to the field.

The other idea is to initially set up the combobox as a "value list" containing all the letters (A;B;C;..;Z) and numbers (0;1;2;..;9). Then if the user clicks the dropdown, and selects a letter it will be very similar to just typing the first letter. You'll have to remember to set your RowSource type back to "Table/Query" before you set the RowSource to your Select SQL statement. You could use the GotFocus event to set the combobox to a value list. (Remember to execute the requery after setting the value list to refresh the list.)
Reply With Quote
  #13 (permalink)  
Old June 7th, 2005, 03:07 AM
Authorized User
 
Join Date: Jun 2005
Location: , , .
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks, that solved that problem!
At what point does the combobox take the value of the text inside it?
I think after update, which is a problem. How can I access what the user typed in?
This is the problem. Let's say the user types T, all the t's are queried and it drops. The user selects one, let's say Tara. The value of the combobox is now Tara so that if the user deletes Tara and types in A (so that it should query all the A's) the value of the combobox is still Tara! I am going crazy trying all the events and nothing seems to work properly.

Reply With Quote
  #14 (permalink)  
Old June 7th, 2005, 03:09 AM
Authorized User
 
Join Date: Jun 2005
Location: , , .
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The strange thing is I don't have this problem with my small test form...

Reply With Quote
  #15 (permalink)  
Old June 7th, 2005, 03:21 AM
Authorized User
 
Join Date: Jun 2005
Location: , , .
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

OK, sorry I figured that out. Ime Sentence Mode was set tp Phrase Predict so I changed it to none.

Reply With Quote
  #16 (permalink)  
Old June 7th, 2005, 03:31 AM
Authorized User
 
Join Date: Jun 2005
Location: , , .
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you so much for your help, I now got the whole thing working. And it really is so much faster. The only problem now is the arrow, if the user presses it before typing when they load the form it the combo is blank! I don't want to do the set focus thing. I think I'm going to try to creat a button on top of it which will comver it up and when the user presses it it will query the whole db, I'll let you know if that works.

Reply With Quote
  #17 (permalink)  
Old June 7th, 2005, 03:37 AM
Authorized User
 
Join Date: Jun 2005
Location: , , .
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Emmm, doesn't work. When the combobox has the focus it is brought to front so you can't see my button!

Reply With Quote
  #18 (permalink)  
Old June 7th, 2005, 05:22 AM
Authorized User
 
Join Date: Jun 2005
Location: , , .
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Oh boy, I have decided to change it to a txtbox, listbox, and button because of this problem. I have not seen a way to slove it.
My new method works great except one thing. The listbox doesn't have the properties selstart and sellength. So I'm back to that problem! ANy suggestions?
Thanks

Reply With Quote
  #19 (permalink)  
Old June 7th, 2005, 05:23 AM
Authorized User
 
Join Date: Jun 2005
Location: , , .
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Sorry, my mistake I don't need it on the listbox, I need it on the txtbox which has it. It works great now.

Reply With Quote
  #20 (permalink)  
Old June 7th, 2005, 05:48 AM
Authorized User
 
Join Date: Jun 2005
Location: , , .
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ok, sorry I keep posting but I think now I finally got it to work. I went back to the combobx(didn't like the other method) and on Mouse down I check if the combobx is blank. If it is I query the whole db, if not then I don't.

Reply With Quote
Reply


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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Loop a select but with a delay between each try chubnut SQL Server 2005 1 June 11th, 2008 07:26 AM
Manually Populating Value in Windows Form ComboBox Ron Howerton VB.NET 2002/2003 Basics 20 February 13th, 2008 07:21 PM
delay in adding tables kondapally Crystal Reports 0 January 12th, 2005 02:27 PM
time delay pab006 Classic ASP Basics 2 January 29th, 2004 05:16 PM
Populating Combobox by Code Syed Afzal Ahmed ADO.NET 1 July 12th, 2003 04:34 AM



All times are GMT -4. The time now is 09:28 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.