Combo value NOT in list problem!!!???? 
Author Message
 Combo value NOT in list problem!!!????

Hi all,

    I have a situation with a combo box...

    The problem is:  When my users put a text string that is NOT contained
in the dropdown list (Style is set to 0 - Dropdown Combo) and move off that
particular record, then back.  At this point the combo text "area" is
blank!!!!

PLEASE HELP,  I have maybe 2 or 3 hairs left on my head!!!!!

PS - using VFP ver 5



Sun, 27 Aug 2000 03:00:00 GMT  
 Combo value NOT in list problem!!!????

Have you ControlSource for combo?

Quote:

>Hi all,

>    I have a situation with a combo box...

>    The problem is:  When my users put a text string that is NOT contained
>in the dropdown list (Style is set to 0 - Dropdown Combo) and move off
that
>particular record, then back.  At this point the combo text "area" is
>blank!!!!

>PLEASE HELP,  I have maybe 2 or 3 hairs left on my head!!!!!

>PS - using VFP ver 5



Mon, 28 Aug 2000 03:00:00 GMT  
 Combo value NOT in list problem!!!????

So this ComboBox is bound to a DB field huh?  I hate ComboBoxes, let me say
that first.  (But of course I need to use them.)  

So you are entering a new value through a combo box eh...

I make no guarantees, ever, but here's an excerpt of code from the Valid()
of a combo box I have that lets the user enter a new value through a Combo
Box.  the Combo Box is bound to a field, and I populate the drop down list
with the existing values (using a SELECT DISTINCT) when the Combo Box is
created.

PROCEDURE Valid
LOCAL lnI, llFound

llFound = .F.

WITH This
        FOR lnI = 1 TO .ListCount
                IF ALLTRIM(.List[lnI])==ALLTRIM(.DisplayValue)
                        llFound = .T.
                        EXIT
                ENDIF
        ENDFOR
        IF !llFound
                .AddItem(.DisplayValue)
                .ListItemID = .NewItemID
        ENDIF
ENDWITH
ENDPROC



Quote:
>     The problem is:  When my users put a text string that is NOT
contained
> in the dropdown list (Style is set to 0 - Dropdown Combo) and move off
that
> particular record, then back.  At this point the combo text "area" is
> blank!!!!



Mon, 28 Aug 2000 03:00:00 GMT  
 Combo value NOT in list problem!!!????

I don't want to add it to the list (but thanks), just want to keep the users
value in the bound field.  (AKA the controlsource).  The users value is just
not there when he/she goes back to the record.

later,
clint



Quote:
>So this ComboBox is bound to a DB field huh?  I hate ComboBoxes, let me say
>that first.  (But of course I need to use them.)

>So you are entering a new value through a combo box eh...

>I make no guarantees, ever, but here's an excerpt of code from the Valid()
>of a combo box I have that lets the user enter a new value through a Combo
>Box.  the Combo Box is bound to a field, and I populate the drop down list
>with the existing values (using a SELECT DISTINCT) when the Combo Box is
>created.

>PROCEDURE Valid
>LOCAL lnI, llFound

>llFound = .F.

>WITH This
> FOR lnI = 1 TO .ListCount
> IF ALLTRIM(.List[lnI])==ALLTRIM(.DisplayValue)
> llFound = .T.
> EXIT
> ENDIF
> ENDFOR
> IF !llFound
> .AddItem(.DisplayValue)
> .ListItemID = .NewItemID
> ENDIF
>ENDWITH
>ENDPROC



>>     The problem is:  When my users put a text string that is NOT
>contained
>> in the dropdown list (Style is set to 0 - Dropdown Combo) and move off
>that
>> particular record, then back.  At this point the combo text "area" is
>> blank!!!!



Mon, 28 Aug 2000 03:00:00 GMT  
 Combo value NOT in list problem!!!????



Quote:
> I don't want to add it to the list (but thanks), just want to keep the
users
> value in the bound field.  (AKA the controlsource).  The users value is
just
> not there when he/she goes back to the record.

Right, but are you saying that the user's input (this is a Dropdown Combo
and not DropDown List) is being written to the data?


Mon, 28 Aug 2000 03:00:00 GMT  
 Combo value NOT in list problem!!!????

If I go look in the table, the users typed info is not there.  just empty...



Quote:


>> I don't want to add it to the list (but thanks), just want to keep the
>users
>> value in the bound field.  (AKA the controlsource).  The users value is
>just
>> not there when he/she goes back to the record.

>Right, but are you saying that the user's input (this is a Dropdown Combo
>and not DropDown List) is being written to the data?



Mon, 28 Aug 2000 03:00:00 GMT  
 Combo value NOT in list problem!!!????

Right.  Well, my situation was almost completely the same as yours, in what
I was trying to do, it seems to me.

Try pasting that code I gave you into that Valid event and see what
happens.  Problem is, entering data through a combo box control (new data)
isn't an "automatic" thing.  We have to do something similar to what I
posted to get it to work.  From what I have been able to discern, you
*need* to have the item present in the drop-down list in order for it to be
the Value of the combo box control.  And if the control is bound by its
ControlSource property, the Value property is directly tied to the field
underneath.  That's why I posted what I did.

If you tried it and it doesn't work, then I guess I should wonder what I
did wrong.  If you haven't tried it, then how can you tell?



Quote:
> If I go look in the table, the users typed info is not there.  just

empty...


Tue, 29 Aug 2000 03:00:00 GMT  
 Combo value NOT in list problem!!!????


Sorry, I missed the beginning of the thread and it's not on my
Newsserver.  Can you repost the code.

It sounds like I am having the same problem.  I want the user to have
the option of entering a value that is not in the lookup table but
after they type it in, it doesn't get save to the underlying main
table (not the look-up table).  Hoe did you get around this?

Thanks in advance for any info!!!

David Nunes

Quote:
>Right.  Well, my situation was almost completely the same as yours, in what
>I was trying to do, it seems to me.
>Try pasting that code I gave you into that Valid event and see what
>happens.  Problem is, entering data through a combo box control (new data)
>isn't an "automatic" thing.  We have to do something similar to what I
>posted to get it to work.  From what I have been able to discern, you
>*need* to have the item present in the drop-down list in order for it to be
>the Value of the combo box control.  And if the control is bound by its
>ControlSource property, the Value property is directly tied to the field
>underneath.  That's why I posted what I did.
>If you tried it and it doesn't work, then I guess I should wonder what I
>did wrong.  If you haven't tried it, then how can you tell?


>> If I go look in the table, the users typed info is not there.  just
>empty...



Fri, 01 Sep 2000 03:00:00 GMT  
 Combo value NOT in list problem!!!????

Sure.. this is what I used.  Keep in mind, the BoundColumn property of the
combo box was 1 in this example because the "lookup" table was actually
just literal text and not an ID of any kind.  Like Microsoft Money seems to
be?

LOCAL lnI, llFound

llFound = .F.

WITH This
        FOR lnI = 1 TO .ListCount
                IF ALLTRIM(.List[lnI])==ALLTRIM(.DisplayValue)
                        llFound = .T.
                        EXIT
                ENDIF
        ENDFOR
        IF !llFound
                .AddItem(.DisplayValue)
                .ListItemID = .NewItemID
        ENDIF
ENDWITH



Quote:

> Sorry, I missed the beginning of the thread and it's not on my
> Newsserver.  Can you repost the code.



Fri, 01 Sep 2000 03:00:00 GMT  
 
 [ 10 post ] 

 Relevant Pages 

1. Combo Typed Value NOT in List

2. adding a user entered value to a combo box drop-down list and a table

3. Dropdown combo - typed value not saved

4. Combo box value is not changed through the mouse click

5. Combo Box Values Typed in not saving!!!!

6. Query not found in VFP 5 combo list

7. Combo Box Value Problems

8. ListBox Value Property = List Item or Actual Value?

9. Adding a Heading for Combo/List box Drop Down list

10. combo box (drop down list) problem

11. leading "\" in list/combo box problem

12. drop down combo list problem in VFP 8

 

 
Powered by phpBB® Forum Software