General information
Category:
Forms & Form designer
>>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.
>>
>>I also tried, in the init, putting the SQL there, then doing AddItem to each record in tmp, and setting the rowsource to 0. I get the same error.
>>
>>Any ideas?
>>
>>-Michelle
>
>Hi,
>
> Though I didn't read your mail carefully but can you afford to have
>
>CREATE CURSOR cDummy (cDummy C(5)
>APPEND BLANK
>
>SELECT code, desc FROM codetable INTO CURSOR tmp ORDER BY code
>UNION
>SELECT '' AS code,' ' AS desc FROM cDummy
>
>Make sure Unions are compitible.
>
>Bye
>Jayesh
Hmmmm... I think that would work. I can also see how I could work that into the combobox class. Since all my code tables have the same structure, I'd just need a property in the combobox to tell what table to work with. I think that'll work good... Thanks!
-Michelle
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only