Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Add new item to combo messed up index
Message
From
29/12/2002 16:41:03
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
Add new item to combo messed up index
Miscellaneous
Thread ID:
00736433
Message ID:
00736433
Views:
41
I have had this problem for a lone time and never knew how to solve. I had
tried asking it here but didn't get a solution. As time is running out on me,
i am getting pretty desperate and so i'm giving it my last shot here and
hopefully somone would help me fix it.

I have this combo box in my form that I'm having trouble with when adding a
new record. I am listing the following to help clarify the picture:

1. In my table "Table1":
fields: s_id (regular key)
name (regular key)
acc_code (regular key)
and 7 other fields.

2. data environment: buffer mode override = 1
order : s_id

3. In my form:
All 3 fields with index key are combo boxes.
cbs_id, cbname, cbacc_code,
rest of the fields are textboxes.

cbs_id: control source: table1.s_id
bound to: .T.
rowsource: table1.s_id,name,acc_code
rowsource type: 6 - fields
select on entry: .T.
sorted: .F.

4. The add record method in the form is fired from a pulldown menu
in the form.

5. Codes in my add_record method:

APPEND BLANK
REPLACE s_id WITH ALLTRIM(sNo) && sNo is a user input value.
THISFORM.refresh
WITH THISFORM.pageFrame1
.ActivePage = 2
.page2.txtremarks.SETFOCUS() && Need to start filling data from pg 2.
ENDWITH

Now the problem:
The record pointer seems get messed up every time a record has
been added.

Symtoms:
a. In adding a record, a value "sNo" is accept from user,
add_record method is called, a new record is successfully
added with only the new s_id filled in. But when i keep
pressing the next record button, i found that the records
don't show in the order they're supposed to.
b. When the table is at the last record and pressing the next button
again, instead of staying at the last rcord, it shows the second
last record in the table.
c. When traversing down the table from top to bottom, I can find the
newly added record. When going up from the bottom record by record,
i can't see the new record.

Apparently the original index has been ruined after the add new record.
Some things had definitely been done wrong here and i just can't sort
it out. Setting buffer mode override to 3 wouldn't help. Setting
thisform.cbs_no.value = sNo instead of using the REPLACE command
wouldn't either, There are a number of other things I've tried all to
no avail.

There must be better ways to handle "add items to combo box records",
but obviously they are beyond my limited skills in VFP. Could someone
show me how i should handle that properly? THank you.
Next
Reply
Map
View

Click here to load this message in the networking platform