Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Displaying Text Value based on Numeric ID
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00338037
Message ID:
00338122
Views:
18
Justin,
It really doesn't matter whether your ID is integer or character, since you're going to do a lookup/relation/other connection between two tables. If you think there is the smallest chance of needing to show the customer name on any form displaying a child table then go with method 2. If this is the only form where you will have the problem put the code into the form refresh method (or better a method called from the form refresh).

Personally I do not care to set relations at all. If an index gets changed somewhere your relations will fall apart, and it will be very difficult to track down the problem.

Finally, your first choice will denormalize your tables because you the table with customer name and customer ID only will be a 'subset' of your main customer table. Both will have to be updated with every add/edit/delete. NOT good programming if there is any other way around the problem as there is here.

HTH
Barbara

>I have designed my relational tables using the recommended Integer fields, but I now am faced with a small challenge. For example, I may have a Customer table with all customer details and an Invoices table that is related back to the customer table based on the CustomerID, an integer field in both tables. What I would like to do is display the customer name on the Invoice form in a text box, not with a Combo Box. The reason for this is that I have placed, next to the text box, a small ellipses button which, when pressed, brings up a find form which can then be used to find the required value. The problem I need solved is what is the best way to do this? For example, you cannot have a numeric value linked to a text box and have the text box display a character value. What I have thought of thus far are two possibilities:
> 1. Create a lookup table containing the CustomerID and CustomerName. When the form loads, a relation is set between Invoices and Customer based on CustomerID. Then when the value is set in the Invoices table, the relation is automatically updated and the text box (which has the control source set to CustomerLookup.CustomerName) then displays the appropriate name.
> 2. Create a container class which contains the label, text box and ellipses button. Everytime the control is refreshed, it
>performs a lookup for the customer name and sets the value of the customer name to the results of the lookup.
>
>If anyone can guide me in the right direction (which may not be either of these solutions), I would be very grateful!
>
>
>Have a great weekend!
>Justin
Barbara Paltiel, Paltiel Inc.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform