Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default ComboBox_Change Event to Populate another Combox

I have a userform that has a combobox for car makes, and I want to make
it so that when a make is selected, the box below it will be populated
with the models of that make.

I already have the makes populating the make comboboxes using ADO on
the UserForm_Initialize event.
I already have a table with all of the make/model info, there is a
column of models with a column that contains their makes, and to pull
the makes, i just SELECT DISTINCT Makes.

I tried making the ComboBox_change event connect and query the database
with the ComboBox.Text, but that causes all sorts of annnoying
ridiculously-hard-to-debug errors, and I am thinking that there must be
a smoother way to do this. Is there an event that occurs after the text
is changed and then idles? or is there a way I can make a combobox
intrinsically tied to an incomplete query, where the above box plugs
the missing link into the incomplete query and then connects and
retrieves the data?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default ComboBox_Change Event to Populate another Combox

How about the Enter event of the second combobox?

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Tobi" wrote in message
ups.com...
I have a userform that has a combobox for car makes, and I want to make
it so that when a make is selected, the box below it will be populated
with the models of that make.

I already have the makes populating the make comboboxes using ADO on
the UserForm_Initialize event.
I already have a table with all of the make/model info, there is a
column of models with a column that contains their makes, and to pull
the makes, i just SELECT DISTINCT Makes.

I tried making the ComboBox_change event connect and query the database
with the ComboBox.Text, but that causes all sorts of annnoying
ridiculously-hard-to-debug errors, and I am thinking that there must be
a smoother way to do this. Is there an event that occurs after the text
is changed and then idles? or is there a way I can make a combobox
intrinsically tied to an incomplete query, where the above box plugs
the missing link into the incomplete query and then connects and
retrieves the data?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default ComboBox_Change Event to Populate another Combox

I tried making a Model1_Enter event, and i get the error message:

"Compile error:
Expected user-defined type, not project"


I am not sure what to do, what I have is a function that connects to
the SQL Server via ADO, and the function takes in a SQL String as a
query, and then attempts to execute the query, and on error returns
false, so it trys and trys until the user gives a string that queries
cleanly, then returns the recordset.

Is there a comprehensive list of events in VB/VBA? I have the O'Reilly
VB/VBA in a nutshell book, and there is no list there, nor have I been
able to find one through search. I am stuck.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default ComboBox_Change Event to Populate another Combox


"Tobi" wrote in message
oups.com...
I tried making a Model1_Enter event, and i get the error message:

"Compile error:
Expected user-defined type, not project"


I am not sure what to do, what I have is a function that connects to
the SQL Server via ADO, and the function takes in a SQL String as a
query, and then attempts to execute the query, and on error returns
false, so it trys and trys until the user gives a string that queries
cleanly, then returns the recordset.



I can't really help you with as little detail as that. Compilere error,
where in the code, I'm supposed to know?



Is there a comprehensive list of events in VB/VBA? I have the O'Reilly
VB/VBA in a nutshell book, and there is no list there, nor have I been
able to find one through search. I am stuck.



If you go into the VBIDE, and view code in the Userform. Select one of the
Combobox event procedures already there and then in the dropdown at the top
right of the code module, click on that and you see all events available for
a combobox.


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default ComboBox_Change Event to Populate another Combox

If you go into the VBIDE, and view code in the Userform. Select one of the
Combobox event procedures already there and then in the dropdown at the top
right of the code module, click on that and you see all events available for
a combobox.

Oh whoa, I totally missed that, thank you, I will more than likely be
able to figure this one out.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Weird Error with ComboBox_Change() Justin[_14_] Excel Programming 5 September 26th 06 07:41 PM
Combobox_change does not repond? Sige Excel Programming 8 October 14th 05 08:59 AM
Combobox_change event problem Shawn G.[_2_] Excel Programming 2 August 18th 05 01:37 PM
ComboBox_Change sub runs unexpectedly ChrisHouchin Excel Programming 0 May 25th 04 07:21 PM
Combox box question David Goodall Excel Programming 2 April 22nd 04 08:16 AM


All times are GMT +1. The time now is 04:44 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"