By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,145 Members | 1,624 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,145 IT Pros & Developers. It's quick & easy.

changing a combobox list from a command button

BigToe
P: 11
Hi folks,
can anyone help me with an easy one:

- access 2000
I have a combo box with client names. the client names change based on two other combo boxes which do requeries. Unfortunately, I can't get the combo box with the client names to show all clients. I've tried using a command button as well as a "all clients" selection in one of the other combo boxes but I'm not saavy enough to code it properly. Any help would be appreciated.
thanks!
Sep 6 '07 #1
Share this Question
Share on Google+
5 Replies


JConsulting
Expert 100+
P: 603
Hi folks,
can anyone help me with an easy one:

- access 2000
I have a combo box with client names. the client names change based on two other combo boxes which do requeries. Unfortunately, I can't get the combo box with the client names to show all clients. I've tried using a command button as well as a "all clients" selection in one of the other combo boxes but I'm not saavy enough to code it properly. Any help would be appreciated.
thanks!

at what time do you want to show ALL clients?

If you have cascading combo boxes, and you want to be able to show all clients vs the filtered combo effect, then IF the clients combo box starts out with ALL clients, the first sub below will do it...
other wise the second option - create a query with all the clients.
With the push of a button, or click on a label, you can set your client box by using something like this

[code=vb]

private sub mycontrol_onclick()
me.mycombo.rowsource = me.mycombo.rowsource
end sub

private sub mycontrol_onclick()
me.mycombo.rowsource = "yourqueryname"
end sub

[code]

not hard right?
J
Sep 6 '07 #2

BigToe
P: 11
I am enlightend. thanks!

hold it *screeech*

i created a command which activates the querry showing all clients (using the second code mentioned), but now the drop down combo boxes don't requery anymore when selecting another criteria. Now all clients are listed the third combo box and the first two combo boxes have no filtering effect. any thoughts?
Sep 18 '07 #3

JConsulting
Expert 100+
P: 603
I am enlightend. thanks!

hold it *screeech*

i created a command which activates the querry showing all clients (using the second code mentioned), but now the drop down combo boxes don't requery anymore when selecting another criteria. Now all clients are listed the third combo box and the first two combo boxes have no filtering effect. any thoughts?
can you paste in the after update events for your combo boxes?
Sep 19 '07 #4

BigToe
P: 11
Recall Client Stats is the name of the form.
Clientstemp is the name of the sub form
so far, I have the 3 combo boxes in the header, and the subform in the body of the form.
cboClients contains the list of all clients.
cboSC is one combo box containing a filter criteria
cboWaitlist is the second combo box with another filter criteria

(i was trying to post a print screen of the form but couldn't figure it out)

Something odd I also noticed is that when selecting a client from the list, where that client shares the same last name with others, the first client among those with the same last name will always be displayed; i.e. selecting the third or fourth 'Smith' from the list always brings up the first 'Smith'. I'm not sure if that's relevant or fodder for another post...

In researching this process i realize there's more than one way to achieve the desired result. i'm willing to start from scratch and learn a more efficient way if need be.

thanks for taking the time!!


Expand|Select|Wrap|Line Numbers
  1. Private Sub cboClients_AfterUpdate()
  2.     'Moves to client Name text box and
  3.     'finds the record of whatever name is selected in the combo box
  4.  
  5.     DoCmd.ShowAllRecords
  6.     Me!Clientstemp.SetFocus
  7.     DoCmd.FindRecord Me!cboClients
  8.  
  9.     'just moves the highlighted cursor away from the Last Name after selection is made
  10.     DoCmd.GoToControl "middle name"
  11.  
  12.     'Set value of combo box equal to an empty string
  13.     Me!cboClients.Value = ""
  14.  
  15. End Sub
  16.  
  17. Private Sub cboSC_AfterUpdate()
  18.  
  19.     DoCmd.Requery "cboClients"
  20.  
  21.         cboWaitlist = ""
  22.  
  23. cboSC_AfterUpdate_Exit:
  24.     Exit Sub
  25.  
  26. End Sub
  27.  
  28. Private Sub cboWaitlist_AfterUpdate()
  29.  
  30.     DoCmd.Requery "cboClients"
  31.  
  32.     cboSC = ""
  33.  
  34. cboWaitlist_AfterUpdate_Exit:
  35.     Exit Sub
  36.  
  37. End Sub
  38.  
  39.  
  40.  
  41. Private Sub cmdAllClients_Click()
  42.  
  43.     Me.cboClients.RowSource = "all clients"
  44.  
  45. cmdallclients_click_exit:
  46.     Exit Sub
  47.  
  48. End Sub
Sep 19 '07 #5

BigToe
P: 11
another piece to the puzzle:

it would seem my Row Source for cboClients has changed to the 'All Clients' querry - perhaps after creating the 'all clients' command button. it would seem my SQL statement has to include 3 querries for the 3 different search criteria:
clients by 'service coordinator' (5 service coordinators)
clients by 'waitlist' (4 regions)
clients by all

I would also like to add 'all waitlisted' clients

I will splunk further on...
Sep 19 '07 #6

Post your reply

Sign in to post your reply or Sign up for a free account.