473,396 Members | 1,879 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

changing a combobox list from a command button

BigToe
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
5 2510
JConsulting
603 Expert 512MB
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
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
603 Expert 512MB
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
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
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

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

Similar topics

1
by: Oren Kaplan | last post by:
Hello, I posted a msg on the Access-related groups in hope someone there could help me but since almost two days have past and I didnt get a response (Im a bit hard pressed with the problem) I...
0
by: Susan Bricker | last post by:
The following error: "The current field must match the join key '?' in the table that seves as t the 'one' side of one-to-many relationship. Enter a record in the 'one' side table with the...
2
by: Susan Bricker | last post by:
I went back to read my post and found an error in my description ... here is the post, again, corrected: The following error: "The current field must match the join key '?' in the table that...
2
by: John Smith | last post by:
Hey folks, I've got a combobox (DropDown List) in a windows form application which is bound to a DataSet. It's value is set to a numeric ID. It's visible text is set to a date. I need to make...
7
by: Sakharam Phapale | last post by:
Hi All, How to preserve the old font properties while changing new one? I posted same question 2 months back, but I had very small time then. eg. "Shopping for" is a text in RichTextBox and...
2
by: Don | last post by:
I've looked high and low for some code that will allow me to have a combobox with a flat borderstyle. I found a few examples, but nothing that was really usable for me. I had the following...
7
by: Arnold | last post by:
Greetings Gurus, In a mainform's header, I have a combobox named comboStudents. The rowsource for this combobox is: SELECT -999 As StudentID, "<Add New Student>" As FullName, "aaa" As...
1
by: Mariel | last post by:
Hello, I hava a main form F1, form with a subform F2 in datasheet view. There is a combobox in the main form C1, and a combobox C2 in the subform. I want the dropdown options of the combobox...
1
by: SnakesRule | last post by:
I'm trying to pass a name from a ComboBox to a MySQL search function, but no matter how I twist it, the get() always returns the first value in the combobox list, regardless of which name the user...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.