View Full Version : Combo Box coding won't work


Loretta
11-26-2001, 03:46 PM
I have 4 combo boxes on a form. Each one is based on a separate table (has Key Field and one more field "A" or "B" etc; only 2 fields per table.) Set to Limit to List. Have a query for each of them with both fields-and ascending order on the 2nd field. I've done this to sort the data alphabetically. On the "Master"Table-where I want all of this to merge, I have the Data that I want from the original tables. Set to Combo Box with the query as the source.

Everything works great except... On the form the boxes are on-I set the NotOnList Event Procdure--it opens the form to add the data to and it works fine. When I do the next combo box the same way, it looks great--until I test it and the code for the 1st box has been taken by the second one. I can only get 1 box to work and save the coding.

What am I doing wrong? How do you save the coding for each box so they will all allow to 'add on the fly'?

Really appreciate any help at all.

Loretta

Pat Hartman
11-26-2001, 06:59 PM
Hi Loretta. Welcome aboard! How're you doing? All my friends are in "Lost Wages" this week playing bridge at the convention center attached to the Hilton. It's a real bummer to have to work to support my bridge habit http://www.access-programmers.co.uk/ubb/smile.gif Silly clients, they think that their deadlines are more important than bridge tournaments!

Anyway, you need to requery the list box at the end of the NotInList event procedure so that they will continue to cascade.

Loretta
11-26-2001, 08:15 PM
Hi Pat! Didn't know if you'd remember me from a few years back...?? Anyway I really appreciate you answering me.

Do I understand you correctly...when I go into the properties on the combo box on the form...to the NotOnList and paste in the code (that I found in my research) that makes them work-one at a time...Do I have to add new code to that somewhere in that coding? Any idea where that code could be found?

I'm not any better at the VB stuff than I was before--so a little more detailed info would be greatly appreciated :-)

Do you want me to send you the code I use to copy and guard with my life??

It sounds like the solution is simple once one knows the answer--as usual. Bottom line as I understand it...for each Combo Box as long as something in there requeries it, it will go to the next combo box and do it right, etc. From what I've researched, Access automatically requeries the data-that's why it shows up in the list so fast...

Actually, I don't care--as long as it works.

By the way, how are the Bridge tourneys going????

Thanks, Loretta

Pat Hartman
11-27-2001, 07:18 PM
The following article from the knowledge base tells you exactly how to handle this:

ACC: Use NotInList Event to Add a Record to Combo Box (95/97)
http://support.microsoft.com/support/kb/articles/Q161/0/07.asp?LN=EN-US&SD=gn&FR=0&qry=notinlist&rnk=2&src=DHCS_MSPSS_gn_SRCH&SPR=ACC97

[This message has been edited by Pat Hartman (edited 11-28-2001).]

Pat Hartman
11-28-2001, 05:48 AM
Just popping this message to the top. I didn't realize that editing a response would not do that.

Loretta
11-28-2001, 11:16 AM
Thanks for the link! I'm going to do my best to figure it out and try it...hopefully my next post on this will be success(!) or another question.

Thanks again!