Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Adding a blank option to a combobox
Message
 
 
À
15/10/1998 17:32:49
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00146606
Message ID:
00147339
Vues:
25
>>Hi all,
>>
>>Frequently, my combo boxes are a list of codes that I use to set a filter. The codes are stored in a table along with their description. So for the recordsource, I use SQL:
>>
>>SELECT code, desc FROM codetable INTO CURSOR tmp ORDER BY code
>>
>>This works great if I want to force them to choose a code. But in some cases, I want them to be able to set the filter to everything. So, I want to put in the option to choose "". I don't, however, want to have "" as a code, since the codes are user-editable and they're likely to delete it. (Yeah, I know, I could get around that, but it makes things much more complicated)
>>
>>Is there an easy way to add the blank choice? I tried setting the SQL, then in the init doing THIS.AddItem(""), but I get an error. I think it was data type mismatch, but this was last night, so I don't remember for sure.
>>
>
>After this SQL, add this
>
>use (dbf()) again alias tmp2 in 0 && make cursor r/w
>sele tmp2
>append blank
>repl tmp2.desc with "(everything)" && nicer description
>use
>sele tmp
>
>Though, this is not a "" in the first column, it is space(len(code)), so you should trim it later when you use it as a parameter for some other SQL.
>
>HTH
That's interesting. I didn't know you could make an SQL cursor writable. I went with the UNION idea, though. It works great.

Thanks,

-Michelle
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform