Combo-Box list unsorting

W

Wissam

Hi, I have a combo box on a form with the list rowsrource type from a table
that contains names of medications. The list on the combo box gets
automatically sorted alphabatically. Is there a way for me to have the list
in the combobox show the data as I want (based on the medication that will be
chosen the most on top of the list of the combobox), rather than
alphabatically?

Another question: On that same form, I added a textbox that had a control
Source a field I (called visitType) in a table called visits. I do not want
this field in the database any more. On the form design view, I deleted the
text box and then deleted the control source field (visitType) from the
table. However,after I did that, whenever I try to open the form again, a
prompt box pups up asking me for the parameter visit.visitType value. On the
field list for the form, I still see the visitType as an option (though it is
not on the form). Is there a way to fix this?

Thanks a lot.
 
D

Douglas J. Steele

Create a query that returns the data in the desired order, and use that
query as the RowSource for the combo box rather than just the table.

For the second problem, take a look at the form's RecordSource. If it's a
query, make sure that the query doesn't include the deleted field.
 
W

Wissam

Thanks a lot for your help.
Your precious suggestion fixed problem 1.
However, I still have problem 2.
I am still in the process of creating my database. I created a Form and I
added text boxes to the form by selecting a table (say Table1), then
drag-dropping fields from Table1 to the Form. I later decided that I do not
want one of the fields (say Field2) in Table1 and the Form. I deleted the
text box for Field2 from the form and then deleted the text box from Table1.
However, in the form Field option, I still see Field2 (ex. the code on the
title of the Field list box for the Form still says something like : SELECT
Table1.Field1,Table1.Field2,..; despite the fact that Field2 should have been
deleted from both the form and Table2. With this, whenever I try to open the
form again, I get a prompt box asking me to "enter parameter value for the
Table1.Field2" . Is there a way for me to fix this. Alternatively, is there a
way for me to open the form and delete Field2 from the SELECT... code
sentence?
Thanks a lot for your help.
 
D

Douglas J. Steele

With the form open in Design view, look at the Properties window. Find the
RecordSource property and select it. That should activate an ellipsis (...)
to the right of the text describing the recordsource. Click on that, and
it'll take you to the query. Change the query, and say Yes when it asks if
you want to save the changes.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top