Combo Box problems with LimitToList property

K

Katherine

I have combo boxes in a form that are bound to fields in a table. I want to
be able to type values in them and have them AutoExpand.

However, Excel won't let me do this. In order to set the LimitTo List
property to "no", I have to have it display multiple fields for the box
instead of just the one I'm interested in. Otherwise I get an error message,
"The first visible column, which is determined by the ColumnWidths property,
isn't equal to the bound colum. Adjust the ColumnWidths property first, then
set the LimitTo List property."

Even when I only include one column in the ColumnWidths property, two
columns show up in the drop-down menu for the combo box.

How can I make this work?

Thanks,
Katherine
 
M

MikeJohnB

Hi Katherine, with the greatest respect, you refer to excel, however, you
have posted in the Access DAtabase news group. You may get a better result
and advice if you post in the Excel news group.

Kindest regards
 
A

Arvin Meyer [MVP]

You do realize that you are using Access, not Excel? <g>

Set the Column Count on the Format tab of the property sheet to 1 and make
sure that the row source only has one field. You will not be able to add new
records unless the PK is an autonumber and there are no other required
fields in the table.

If the combo is a lookup to another table, you will need to use code in the
limit to list property, because you will not be able to add a record
otherwise. There is some code here:

http://www.datastrat.com/Code/NotInListCode.txt

and an example of how to use it here:

http://www.accessmvp.com/Arvin/NotInListDemo.zip
 
S

Sylvie

Hi Arvin,
I am sorry to jump in, but I have a problem which I can solve it. I tried to
use your code in my form and did not work. I am new to VBA, however I tried
to understand whre to change to my forms names, etc. Can you help me? I have
a form VISIT where a combo box show me the patient names, if Anna is not
there I am adding her; so a command button open the PATIENT form and the user
will look for not to add again, if not find will add tothe form. Then when
save it shows the argument: "You cannot add or change a record because a
related record is required to table VISIT. On table visit PATID is numeric
and was a lookup field; hwever I changed it to text box only
 
S

Sylvie

I Fixed the problem! The relationship of the tables were one-to-many; I've
changed to one-to-one and worked. Thnaks
 

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