Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Mimic Combo box by Text Box
Message
From
25/11/1997 11:34:35
 
 
To
24/11/1997 18:47:54
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00062041
Message ID:
00062178
Views:
18
Hi. To amend Jim's comment...You can still have multiple codes associated with the first table without resorting to code1, code2, and so on (what if they want to add code4...code99?). The trick is to use a third table as a cross-reference between the parent table and code lookup table. What's nice is that you have a flexible and easily maintainable association between codes. For example, you don't have to worry about them adding the same code in more than one of the available fields (tho' there are cases I can think of where that would be ok.) Then your form can use a list box (and mover box technology) for maintaining viewing the data.

As for the problem your having with your codes displaying in the textboxes--to get this to work, add your look up codes table three times to your data environment and bind the text/combo controls each to a different alias. What your doing now is looking into the table three times from the same "port" but what you really want to do is look into the table at three different places.

HTH

ILLUSTRATION ONLY
------------------------------------

CodeTable.id && field from Code Table --Primary Index ID

Codes.id && unique id field from your codes -- Primary Index ID
Codes.description && description of the code

Add a third table called codeXref && ie code cross-reference

codeXref.CodeTableID && -- regular index
codeXref.CodesID -- regular index

There's a (better) way to do this with a select, but it's simpler for me to do it so:

USE codeTable IN 0 ORDER TAG ID
USE codes IN 0 ORDER TAG ID
USE codeXref IN 0 ORDER TAG CodeTableID

SELECT codeXref
SET RELATION TO codeTableID INTO codeTable
SET RELATION TO codesID INTO codes ADDITIVE

BROWSE FIELDS codeXref.CodeTableID, codeXref.CodesID, codeTable.id, codes.id, codes.description


>C.L.
>
>Not the answer you want to hear, I am sure, but you would be better off changing CodeTable to have only one field for Code.
>This would simplify many things (as you are discovering for yourself).
>
>Good luck,
>Jim N
>
>>I have a table, let's say CodeTable, which have 3 fields, code1, code2, and code3. Their corresponding descriptions are stored in table DescriptionTable. In other words, they are all referring to the same table. What I need to do is to show the code1, code2, code3 and their corresponding descriptions on the same form. Since DescriptionTable has more than 6,000 records, combo box will not be a good choice. I tried to use text boxes, i.e., 3 text boxes for the codes, and 3 for the descriptions. However, what I got for the descriptions are the same for all the three text boxes. To make the case worse, only code1 have a value all the time. Code2 and code3 may or may not have values. Do anyone know how I can accomplish my task? If text box is not a good choice, what else can I use?
>>
>>Thanks in advance.
>>
>>
>>Chu
Previous
Reply
Map
View

Click here to load this message in the networking platform