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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combo Box Within a Form 1

Status
Not open for further replies.

SMHSleepy

Technical User
Sep 8, 2009
174
CA
Hello, I have a main form listing patient demographic information. Each day, we have roughly 50/50 new vs. existing patients to enter. Instead of the standard "Find" button to search for existing patients, which I currently have, I would like the last name (PtLName) to be in the form of a drop down list sorted by last name. If the patient exists, I just choose it and the rest of the fields fill accordingly. If the patient does not exist, I can just click my "Add New Patient" button. Can anyone help me with this? Thank you.
 
You need to set up a query giving the values you want, and set that query as the record source for the combo box.

--

"If to err is human, then I must be some kind of human!" -Me
 
very true - much better use of the form.

SMHSleepy,

There are plenty of examples out there on what Randy700 is talking about. If you give it a try, but still need help, let us know.

--

"If to err is human, then I must be some kind of human!" -Me
 
Thank you both. I can't wait to try it; however, I'm currently locked out of my database (see other post). I should have it running again by this afternoon and will post my progress. Thanks again!
 
Okay, tried it but must be doing something wrong. I created a query of demographics then created a combo box based on this query. When the wizard asks me to either store a value for later use or save it to a field, I tried both: when store for later use, does nothing and just acts like an unbound field. When save it to "LastName", it changes the LastName of the current record. Please tell me what I'm doing wrong? When I choose the correct record from the combo box, I'd like it to just show me that record (like a find command) and not edit the record. Thanks
 
Hmm, try it this way:

1. Create a new combo box, and skip the wizard - when the wizard comes up, just hit the cancel button.

2. Right-click, properties for the new combo box.

3. Give it a name if you wish - it's actually best to name everything correctly according to a naming standard, such as Reddick. (the name is listed on the "other" tab of properties.

4. On the data tab, under control source, select the query you created, assuming you created a query. If you didn't create a query, select the table containing the data you want, and then click the build box - the little box/button with a couple dots on it - to the right. There you'll build the query, basically, then close out of the query when you finish, I think say no to save, and then click the OK button for the combo box... then see what you've got. you can customize it later, with the notinlist command, etc, once you've got it working correctly.

--

"If to err is human, then I must be some kind of human!" -Me
 
Made it to 4. but under control source it only lists all the fields of my demographics table, not my query.
 
Sorry, I meant "Row Source".

It is just under Control Source.

--

"If to err is human, then I must be some kind of human!" -Me
 
Arrrrrgh, still doesn't work. It gives me the list but it's still unbound so clicking a name does nothing.
 
What do you mean, when you click it? When you click a combo box, the list should drop down, or else you just start typing the name, and it'll auto populate, unless you've got that option turned off.

As far as updating the values, if you are trying to update the values into a different table, as you've got your form's control source set to, then that's the table it wants to update. The Control Source is what you update with the combo box. The record source is what gives you the list of available entries.

If you want to update the list with the original entries, then you need to put some code behind the "not-in-list" event.

--

"If to err is human, then I must be some kind of human!" -Me
 
Thanks for the help. I've obviously been too ambiguous with my question to hope for an easy solution. As it turns out, using a customized "Find" button works better anyway. I figured out how to make it default to the field I want to search so all is good now. Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top