INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Combobox (style 0) not allowing non-listed input

Combobox (style 0) not allowing non-listed input

(OP)
Hello, I am having an issue with Style 0 Comboboxes where when a user enters something in the box that is not a contained item, it will not store to tables or so on when it is time to use the value of the object. Any help is greatly appreciated!
Thanks!

RE: Combobox (style 0) not allowing non-listed input

I assume you expect what you type in the Combobox should be stored into the rowsource. That's not happening.
Every control saves to it's controlsource (the grid is an exception, but within it, the columns all maintain their controlsource, too).

As you see the Combobox has two data sources. The data source to define its items is the rowsource. The controlsource both determines what item is picked and where the picked item or entered text is saved.

The entered text becomes the value of the combobox, just like the picked item text. Unless you bind the controlsource to an integer foreign key field, that won't work with a dropdown combo style combobox.

Anyway, the combobox never maintains the items. You can have a textbox with autocomplete feature, if you want that. Or program the adding of items yourself.

Bye, Olaf.

RE: Combobox (style 0) not allowing non-listed input

What you are seeing is normal. It is how Stype 0 combo boxes are designed to work.

It might help to keep the following in mind:

If the user picks an existing value from the list, the Value property will contain that value. If the combo has more than one column, the Boundcolumn property indicates the column from which the Value is taken. The DisplayValue property always contains the value from the first column.

If the user types in a new value, the Value property will be empty; DisplayValue will contain the value that the user types.

In the second case, you need to write code to update the underlying table (or take whatever other action is appropriate). If that action results in adding the new value to the list, you should call the combo box's Requery method in order for the list to be updated.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close