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

DBLookupComboBox Default & blank values

Status
Not open for further replies.

CritterLover

Programmer
Jul 21, 2003
19
0
0
US
I've got some DBLookupComboBoxes that I'm using to add new records. When I close the form used to add records, next time I open up the form the old values are still there. When it's used the first time, it's blank and I'd like one to come up blank and one to have a default value. When I've tried to set the value in .Text it says that it's a ReadOnly property even though I've set the property of the combo box to .ReadOnly := false; and it says that it's false. Properties are set:

Datafield - blank
DataSource - blank
ListSource - DSDVLRelate (my DataSource)
DataSet - QryDVLRelate (my Query used by the DataSource)
DataSet.Database Name - DVData
DataSet.DataSource - blank
DataSet.AutoRefresh - True

I'm using version 7 if that matters. I've been trying every property and method I can think of and have had no luck. I can't find anything about this in help or the books I have...
Thanks! This is my first time posting a question, so I hope I've given all the necessary info.

 
Check out the ApplyUpdates method on TQuery because you might not be saving your changes back to the dataset, and if you want editing everything from your TTable or TQuery on through has to have readonly set false.

With D7 it helps to know if you're using traditional DB access or DBExpress, as they work differently (you need a couple of extra components):
 
Maybe you are using the wrong component. If you need pre-defined values us a dbComboBox

A dbLookupComboBox is used to enforce referential entegrity. The values are supplied by another (look-up) table in the database. That way you cannot sell something to a client who is not defined (yet).

Check out also:
How to use Look Up fields with Tables /Queries
faq102-1212

Regards

Steven van Els
SAvanEls@cq-link.sr
 
For anybody else trying to set a combo blank I found this works. I put it in the FormActivate:
DBCboFamRelFTPT.KeyValue := null;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top