Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Big problem, please help!
Message
From
18/04/1998 20:23:38
Raul Davila
Davila Programming Services
Toa Alta, Puerto Rico
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
Big problem, please help!
Miscellaneous
Thread ID:
00093210
Message ID:
00093210
Views:
48
I'm just about to complete a HUGE project and discovered a major bug (mine).
In a lot of places I have comboboxes whose source is a small table.
The table has two fields (ID, DESCRIPTION). ID is sequential starting from 1. I save the last ID used in my config.dbf and use that value to generate a new ID whenever needed.

When the user selects an item from the combo I save the ID value on the other tables.

If I delete an item from the table, the rest of the IDs are not "synced" anymore.

Eg:

ITEMS.DBF (ID N(5), DESCRIPTION C(20))

rec1: 1, "Description 1"
rec2: 2, "Description 2"
rec3: 3, "Description 3"
rec4: 4, "Description 4"

WITH MyCombo
.RowSourceType = 6 - Fields
.RowSource = ITEMS.DESCRIPTION, ID
.BoundColumns = 2 &&the column containing ITEMS.ID
.ColumnWidths = 75,0
.some other things not important
ENDWITH
The combo shows the DESCRIPTION field only and the ID value is saved.

SOME_TABLE.DBF (FIELD1, FIELD2, ITEM N(5))

rec1: ..., ..., 1
rec2: ..., ..., 3

Now if I delete one of the first two records in ITEMS the table that has a reference to ITEM = 3 will show a wrong value in the combobox
In rec2 SOME_TABLE.ITEM = 3 but now the third record in ITEMS has "Description 4"
The next time the user opens the form with the combo, the wrogn value will be showed. Worst than that if he saves the data the wrong value will be saved.

I think I might have to use .List, .ListItemID, etc...
I have a short deadline and need the easiest way to solve this w/o having to change tons of code.

TIA
R. Davila
DBA / Network Administrator
Administracion de Fomento Comercial
Gobierno de Puerto Rico

Still waiting for FoxPro for LINUX
Next
Reply
Map
View

Click here to load this message in the networking platform