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

Displaying a blank control-source

Status
Not open for further replies.

AndrewMozley

Programmer
Oct 15, 2005
621
GB
I have a table of suppliers which includes two fields, supp_code C(4) and supp_desc C(30). A table of products includes a field prod_scode, which identifies the associated supplier, or it may be blank.

On the form for maintaining the product table there is a combo to allow display and selection of the supplier code. Its Rowsource is supplier.supp_code, supp_desc and its Controlsource is product.scode. On this form there is also a textbox to display the supplier-name; its Controlsource is supplier.supp_desc.

This generally works fine; when the form is located on a particular product, the description of its related supplier is displayed.

What is the best way of handling cases where the prod_scode field is blank - either by the user typing a blank into the combo to change it, or when a particular product is retrieved. In these cases I want the supplier-name textbox on the form to be blank.

Thank you.
 
If you would work with cursors instead of dbfs the answer is simply adding a blank record to the cursor including the blank, empty or NULL key. That wouldn't go back to the DBF but would solve your optional reference.

Bye, Olaf.

 
Thank you Olaf. That works well. I was at first reluctant to introduce a cursor because of the overhead involved in reading all the records in the supplier table (there may be about 4,000), but that does not seem to be a problem.

Andrew
 
Hmmm. 4,000 rows in a combo box? That sounds uncomfortably high to me. Not because of any performance issues, but rather because it risks becoming unwieldy and cumbersome to navigate. But if you are happy with it, so be it.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Hmmm. 4,000 rows in a combo box? That sounds uncomfortably high to me. Not because of any performance issues, but rather because it risks becoming unwieldy and cumbersome to navigate. But if you are happy with it, so be it.

I completely agree. A list with more than a dozen-or-so items is unwieldy.

Think about Windows Explorer as an example. An Explorer window is basically a list. It has a lot of formatting and sorting options (that VFP lists do not have), but it's basically a list. I *hate* dealing with folders that have more than a few dozen files in it. Up to a few hundred and it can be agony. A few thousand? Nearly impossible. And that's with a list that has sorting and formatting options.

(I can give Windows Explorer a pass from a U/I standpoint -- but just barely -- because it wasn't Windows that decided to put that many files in a folder. :))

 
Yes, actually anything else in your main table should perhaps limit the number of suppliers making sense for choice. And another solution is just displaying the supplier name in a readonly textbox, adding a browse button [...] to start a supplier choice form, which will show the supplier list in a filterable extra form, starting with eg only suppliers supplying a certain product or most recently used. A combo is not applicable for a larger list of related choices.

Bye, Olaf.
 
I'll take a contrary stand. A long list/combo is workable if (and only if) the user can navigate quickly by starting to type the desired value, that is, the Quicken-type combo.

Tamar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top