Combo Box problems 
Author Message
 Combo Box problems

Hello,

The Problem i face is:

1)I have a combo box in a form(form a).
  The properties is like this :
            Boundcolumn=2
            Controlsource=tableB.aid
            Rowsource= tableA.Name,tableA.aid
            Rowsourcetype=6-fields

 (tableA.aid=N7,Name=C30)
TableA.aid is a primary key field.Assume that in TableA
contain 10 record and the value in aid field is begin with
1 untill 10.While i delete a record(Record No.6) and issue
a pack command ,now the value in tableA.aid is like this :

          1,2,3,4,5,7,8,9,10

Jump to the form A , when i select the combo box , it display
the value same like tableA.aid. But,when i select
value 7 in the combo box,6 is save in the tableB.aid
if i select value 8 ,tableB.aid value will become 7.
So in the end,the value in tableB.aid is like this :

          1,2,3,4,5,6,7,8,9

The combo box is display the correct tableA.aid value,
but return the wrong value into the tableB.aid .

How come like this ?? how can i solve this problem??

Note : TableB.Aid=N7
       i using VFP 6.0 (no service pack install yet)

2)How to prevent user to select data that alreadly exits
  in the controlsouce table , for the combo Box?
  Example :
           Properties in ComboBox :
               Controlsouce=Table1.AID
               Rowsource= table2.AID

Let say Table2.AID display value 1-5 , when i select a value
(No.3) in the combo box, before save in the table1.aid ,
i need to verify this value(No.3) whether is a duplicate data
in table1.aid.If table1.aid already contain a value (No.3)
an error message will prompt to user to re-select another value
in the combo box again untill a non-duplicate data is be selected.

Any idea to do this ??

thanks a lot for you help !!!



Thu, 18 Jul 2002 03:00:00 GMT  
 Combo Box problems
Enry,

1)
If your .ControlSource is a numeric type, you'd need to set the .BoundTo
property to .T.
Maybe it's a typo but the .rowsource should be "tableA.name,aid" (instead of
"tableA.Name,tableA.aid").

2)
You could
a) set the .RowSourceType to 3 - SQL statement
and .RowSource to something like
select aid from table2 where aid NOT in (select aid from table1) into cursor
t_cboAid
to get a list without forbidden values
or
b) in the cboAid.Valid()
if indexseek(This.Value,.F.,"table1",cYourAidTagName)
    =messagebox("helpfull message")
    return .F.
endif

Hope this helps,
-Stefan


Quote:
> Hello,

> The Problem i face is:

> 1)I have a combo box in a form(form a).
>   The properties is like this :
>             Boundcolumn=2
>             Controlsource=tableB.aid
>             Rowsource= tableA.Name,tableA.aid
>             Rowsourcetype=6-fields

>  (tableA.aid=N7,Name=C30)
> TableA.aid is a primary key field.Assume that in TableA
> contain 10 record and the value in aid field is begin with
> 1 untill 10.While i delete a record(Record No.6) and issue
> a pack command ,now the value in tableA.aid is like this :

>           1,2,3,4,5,7,8,9,10

> Jump to the form A , when i select the combo box , it display
> the value same like tableA.aid. But,when i select
> value 7 in the combo box,6 is save in the tableB.aid
> if i select value 8 ,tableB.aid value will become 7.
> So in the end,the value in tableB.aid is like this :

>           1,2,3,4,5,6,7,8,9

> The combo box is display the correct tableA.aid value,
> but return the wrong value into the tableB.aid .

> How come like this ?? how can i solve this problem??

> Note : TableB.Aid=N7
>        i using VFP 6.0 (no service pack install yet)

> 2)How to prevent user to select data that alreadly exits
>   in the controlsouce table , for the combo Box?
>   Example :
>            Properties in ComboBox :
>                Controlsouce=Table1.AID
>                Rowsource= table2.AID

> Let say Table2.AID display value 1-5 , when i select a value
> (No.3) in the combo box, before save in the table1.aid ,
> i need to verify this value(No.3) whether is a duplicate data
> in table1.aid.If table1.aid already contain a value (No.3)
> an error message will prompt to user to re-select another value
> in the combo box again untill a non-duplicate data is be selected.

> Any idea to do this ??

> thanks a lot for you help !!!



Sun, 21 Jul 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Combo Box Problems!!!

2. combo box problem

3. Help! Combo Box Problem

4. combo box problem

5. VFP 3.0 ListBox / Combo box problem

6. drop down combo box problems

7. Combo Box Problem

8. Combo Box Problem

9. Combo Box Problem

10. Combo box problem VFP3.0

11. Urgent: Combo Box problem!!!

12. combo box problem

 

 
Powered by phpBB® Forum Software