Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Refresh Combobox View after requery 2

Status
Not open for further replies.

smurf01

IS-IT--Management
Jul 6, 2002
470
GB
Hi,
I have three combo boxes

cmbFlute (3 values : B,C,CB)
cmbType (7 values : ( G,K,L,M,O,T,W)
cmbPapers ( numerous values)

cmbType is requeried from cmbFlute
cmbPapers is requeried from cmbType

when I select a value from cmbFlute the data is filtered in cmbType.

When I the select a value from cmbType the data is filtered in cmbPapers.

Then when I update cmbPapers a subform(frmFTPResults)is refreshed.

"OK" that is working fine however when I want to do the same again after selecting a value from cmbFlute although cmbType is refreshed the last selection made is still showing in the combobox until i actually click the dropdown arrow. is it possible to make the requery re-populate the combobox before clicking.

i.e. if the last selected value was "O" when the requery is done I would like to see the first value in the display area which in this case would be "G"


Regards

Paul
 
Ken,
I am not sure if I have explained myself properly

If I have selected a value from cmbFlute and cmbType and cmbPapers to update the query. When I select a value from cmbFlute again, the value in cmb Type is still showing the old value, I would like to be able to clear that value after requery so the display area is blank

Regards

Paul
 
Hi,

How about this to reset the combo to the first item:

cmbType.value = cmbType.itemdata(0)

I`m not sure if this would work on Access 2000, but it works for me on Access 97.

Or if you want to clear the value:

cmbType.value = NULL

I guess you would put these lines after your requery line.
Hope that helps,
Danny
 
Hi

Obviously two of thought you wanted the first value in the list, but as Danny says if you want to clear the combo:

cmbType = NULL

or

cmbType = ""

will do it



Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Ken/Danny

Ken, my problem was that when I used
Code:
cmbType = cmbType.Column(0,0)
I found that the cmbType box was being populated by the first value from cmbFlute, I don't know why this would happen. I tested your other two pieces of code and they worked great.

Danny, Thanks for the info I used your code and it worked well

A Star for both of you

:-D [2thumbsup] :-D

Regards

Paul
 
Hi

Thanks for the star

"Ken, my problem was that when I used cmbType = cmbType.Column(0,0) I found that the cmbType box was being populated by the first value from cmbFlute, I don't know why this would happen"

the values in the list for a combo box may be regarded as an array of columns, the array elements are numbered from zero, so .Column(0,0) is the first element of a two column list box

.ItemData() is the list of possible values to select
.ListCount is the number of values in .ItemData, zero means the list is empty

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Hey Ken,

Thank you for the extra info, it's always nice to pick up any snippets like that when you are learning.

[2thumbsup]

Regards

Paul
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top