Wrox Programmer Forums
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 6th, 2005, 07:02 AM
Authorized User
 
Join Date: Jun 2005
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...

 
Old June 6th, 2005, 07:57 AM
Friend of Wrox
 
Join Date: Nov 2004
Posts: 248
Thanks: 0
Thanked 1 Time in 1 Post
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.)
 
Old June 7th, 2005, 02:07 AM
Authorized User
 
Join Date: Jun 2005
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.

 
Old June 7th, 2005, 02:09 AM
Authorized User
 
Join Date: Jun 2005
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...

 
Old June 7th, 2005, 02:21 AM
Authorized User
 
Join Date: Jun 2005
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.

 
Old June 7th, 2005, 02:31 AM
Authorized User
 
Join Date: Jun 2005
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.

 
Old June 7th, 2005, 02:37 AM
Authorized User
 
Join Date: Jun 2005
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!

 
Old June 7th, 2005, 04:22 AM
Authorized User
 
Join Date: Jun 2005
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

 
Old June 7th, 2005, 04:23 AM
Authorized User
 
Join Date: Jun 2005
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.

 
Old June 7th, 2005, 04:48 AM
Authorized User
 
Join Date: Jun 2005
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.






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 06: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 03:34 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.